#K49307. Unique Candy Gift Combinations

    ID: 28613 Type: Default 1000ms 256MiB

Unique Candy Gift Combinations

Unique Candy Gift Combinations

Anita wants to create unique candy gift boxes. For each type of candy, she has a limited quantity available. For a test case with N candy types and corresponding maximum quantities \(Q_1, Q_2, \dots, Q_N\), she can choose any amount from \(0\) to \(Q_i\) (inclusive) for the ith type. The total number of unique combinations she can make is given by the formula:

$$\prod_{i=1}^{N} (Q_i+1)$$

Given several test cases, calculate the number of possible combinations for each.

inputFormat

The first line of input contains an integer (T) representing the number of test cases. For each test case, the first line contains an integer (N) (the number of candy types). The next line contains (N) space-separated integers, where the (i)th integer represents (Q_i), the maximum quantity available for the (i)th candy type.

outputFormat

For each test case, output a single line containing the total number of unique candy combinations that can be formed.## sample

1
1
2
3

</p>