#C10646. Modified Sequence Reversal

    ID: 39874 Type: Default 1000ms 256MiB

Modified Sequence Reversal

Modified Sequence Reversal

You are given (T) test cases. In each test case, a sequence is provided in reverse order along with an integer (N) representing the number of elements. Your task is to first reverse the sequence to restore its original order and then modify the sequence by multiplying each element by its 1-based position. In other words, if the restored sequence is (a_1, a_2, \dots, a_N), then the output should be (a_1 \times 1,\ a_2 \times 2,\ \dots,\ a_N \times N).

For example, if the input sequence is given as 9 7 5 for (N = 3) (i.e. originally provided as 5 7 9 after reversal), the modified sequence will be 5, 14, 27.

inputFormat

The input is read from standard input (stdin). The first line contains a single integer (T) denoting the number of test cases. Each test case consists of two lines: the first line contains an integer (N) representing the number of elements, and the second line contains (N) space-separated integers denoting the sequence (provided in reverse order).

outputFormat

For each test case, output a single line to standard output (stdout) containing the modified sequence. Each element of the modified sequence is the product of the corresponding element from the restored sequence and its 1-based index. The elements should be separated by a single space.## sample

2
3
9 7 5
4
10 20 30 40
5 14 27

40 60 60 40

</p>