A. Memory and Crow time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output
There arenintegersb1, b2, ..., bnwritten in a row. For allifrom1ton, valuesaiare defined by the crows performing the following procedure:
The crow setsaiinitially0. The crow then addsbitoai, subtractsbi + 1, adds thebi + 2number, and so on until then'th number. Thus,ai = bi - bi + 1 + bi + 2 - bi + 3....
Memory gives you the valuesa1, a2, ..., an, and he now wants you to find the initial numbersb1, b2, ..., bnwritten in the row? Can you do it?
Input
The first line of the input contains a single integern(2 ≤ n ≤ 100 000)— the number of integers written in the row.
The next line containsn, thei'th of which isai( - 109 ≤ ai ≤ 109)— the value of thei'th number.
Output
Printnintegers corresponding to the sequenceb1, b2, ..., bn. It's guaranteed that the answer is unique and fits in 32-bit integer type.
Examples input
56 -4 8 -2 3
output
2 4 6 1 3
input
53 -2 -1 5 6
output
1 -3 4 11 6
Note
In the first sample test, the crows report the numbers6, - 4,8, - 2, and3when he starts at indices1,2,3,4and5respectively. It is easy to check that the sequence24613satisfies the reports. For example,6 = 2 - 4 + 6 - 1 + 3, and - 4 = 4 - 6 + 1 - 3.
In the second sample test, the sequence1, - 3,4,11,6satisfies the reports. For example,5 = 11 - 6and6 = 6.
#include<cstdio>#include<cstring>const int maxn = 1e6 + 10;int a[maxn];int main(){int n;while(~scanf("%d",&n)){for(int i = 0 ; i < n ; i++)scanf("%d",&a[i]);for(int i = 0 ; i < n-1 ; i++)printf("%d ",a[i] + a[i+1]);printf("%d\n",a[n-1]);}return 0;}