Statement
The initial rating is . You participate in contests in order, and your performance in the -th contest is .
After each contest, the rating is updated by giving weight to the previous rating and weight to the current performance. The rating after the -th contest is
It is guaranteed that is a positive integer for every ().
Find the final rating .
Input
The input is given in the following format:
Each case is given in the following format:
is the number of test cases. Each case gives the initial rating , the number of contests , and the performances in contest order.
Output
For each test case, print the final rating on one line.
Constraints
- .
- .
- .
- ().
- The rating after every contest is an integer satisfying ().
- The sum of over all test cases is at most .
Subtasks
Samples
In the first case, the rating changes as .
In the first case, each performance equals the current rating, so the rating stays unchanged. In the second case, it changes as .