JIXMPII5JUgTXH0#)&+

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Statement

You are given an array x2,x3,,xn x_2,x_3,\dots,x_n . Your task is to find any array a1,,an a_1,\dots,a_n , where:

  • 1ai109 1\le a_i\le 10^9 for all 1in 1\le i\le n .
  • xi=aimodai1 x_i=a_i \bmod a_{i-1} for all 2in 2\le i\le n .

Here cmodd c\bmod d denotes the remainder of the division of the integer c c by the integer d d . For example 5mod2=1 5 \bmod 2 = 1 , 72mod3=0 72 \bmod 3 = 0 , 143mod14=3 143 \bmod 14 = 3 .

Note that if there is more than one a a which satisfies the statement, you are allowed to find any.

Format

Input

The first line contains a single integer t t (1t104) (1\le t\le 10^4) — the number of test cases.

The first line of each test case contains a single integer n n (2n500) (2\le n\le 500) — the number of elements in a a .

The second line of each test case contains n1 n-1 integers x2,,xn x_2,\dots,x_n (1xi500) (1\le x_i\le 500) — the elements of x x .

It is guaranteed that the sum of values n n over all test cases does not exceed 2105 2 \cdot 10^5 .

Output

For each test case output any a1,,an a_1,\dots,a_n ( 1ai109 1 \le a_i \le 10^9 ) which satisfies the statement.

Sample

5
4
2 4 1
3
1 1
6
4 2 5 1 2
2
500
3
1 5
3 5 4 9
2 5 11
5 14 16 5 11 24
501 500
2 7 5

ShanghaiTech ACM 炸鱼杯

未参加
状态
已结束
规则
OI
题目
46
开始于
2024-12-10 23:00
结束于
2024-12-15 13:00
持续时间
110 小时
主持人
参赛人数
112