Mirko is practicing arithmetic operations in an interesting way during math class. First, he writes a sequence of integers . Then, underneath the first sequence, he writes another sequence of integers which he gets by replacing every number from the sequence with the average value of all the numbers before the current one, including it.
For example, if the first sequence of integers is equal to
then the second sequence of integers is going to be
in other words
You are given the second sequence of integers . Determine the first sequence of integers to check Mirko's calculations.
Input
The first line of input contains the integer , the length of sequence .
The second line of input contains the sequence of space-separated integers .
Output
The first and only line of output must contain a sequence of space-separated integers .
Please note: The input data will be such that the elements from the sequence are integers .
Sample Input 1
1
2
Sample Output 1
2
Sample Input 2
4
3 2 3 5
Sample Output 2
3 1 5 11
Sample Input 3
5
1 2 2 3 4
Sample Output 3
1 3 2 6 8
Explanation of Output for Sample Input 3
Look at the task description.
Comments
Are the example outputs wrong? for the second output, would the integers not be 3, (3+2)/2, (3+2+3)/3, (3+2+3+5)/4? So 3, 2.5, 8/3, 13/4?
No, the example outputs do not contain errors; you are trying to obtain an array that would result in sample input if you performed the above operation.
Oh I'm sorry you're working backwards. Thanks