Just Sum It
Given the number of available digit of 1 to 9, sum all possible numbers generated from those digits. For example,
It means that we can use up to two digits of 2, one digit of 4 and one digit of 6. There are exactly 34 distinct numbers that can be constructed using the above digits: 2, 4, 6, 22, 24, 26, 42, 46, 62, 64, 224, 226, 242, 246, 262, 264, 422, 426, 462, 622, 624, 642, 2246, 2264, 2426, 2462, 2624, 2642, 4226, 4262, 4622, 6224, 6242, 6422. The sum of all those numbers is 51622.
Input
The first line contains the number of test cases t (t ≤ 500). Each testcase contains nine integers P_i (0 ≤ P_i ≤ 9) denoting the number of i-th digit (1 ≤ i ≤ 9).
Output
For each testcase, output in a single line the sum of all possible numbers generated from the available digits. Print the answer modulo 1,000,000,007.