Let denote a finite sequence of numbers. A subsequence of consists of some terms of in their original order. is considered to be a subsequence of itself. An empty sequence of is also a subsequence of . For any sequence , let denote the number of distinct subsequences of . For example, if , then , because has the following 12 distinct subsequences:
Input Specification
The first line will contain an integer , representing the number of test cases.
The next test cases will consist of two lines.
The first line will contain , representing the number of numbers in . For 30% of the points, .
The next line will contain space-separated digits (0-9), representing each number in .
Output Specification
For every test case, output the value of on a new line. is not guaranteed to fit in a 32-bit signed integer.
Sample Input 1
2
0
4
1 2 2 1
Sample Output 1
1
11
Explanation 1
The first and only subsequence of of the first test case is simply , due to being an empty set.
The subsequences of for the second test case are:
Sample Input 2
2
8
6 6 6 6 6 6 6 6
3
1 2 3
Sample Output 2
9
8
Explanation 2
For the first test case, the subsequences of are:
For the second test case, the subsequences of are:
Comments