The first line of input contains one integer Q(1<=Q<=25), specifying the number of test cases to consider. The following 3Q lines of input contain descriptions of test cases. Each test case is described by three lines of input.
Your program should output q lines, one line per each test case in the same order as in the input.
8 -1 40 60 82 97 102 110 120 140
22 37 42 52 52
Explanation to the example: In the first case, in frame 5 after the character "x" the only possible character is "-". In frame 8 the player got 8 points in total. Thus there are 9 possibilities how this sum could have been obtained:0+8,1+7,….8+0. There were no bonus points in frame 9. Therefore, there were no points on the first shot of the final frame. To obtain 20 points in the last two shots, the only possibility is a spare with a following strike in the last shot of the frame. Therefore there are 9 different valid games which correspond to this input data.