Problem list
Log in
#coci00315 · COCI 2014/2015 Contest 1

Prosjek

Bronze II 1.0 s 256 MB

Mirko is practicing arithmetic operations in an interesting way during math class. First, he writes a sequence of integers $A$. Then, underneath the first sequence, he writes another sequence of integers $B$ which he gets by replacing every number from the sequence $A$ with the average value of all the numbers before the current one, including it.

For example, if the first sequence of integers $A$ is equal to

$$\displaystyle 1, 3, 2, 6, 8$$

then the second sequence of integers $B$ is going to be

$$\displaystyle \frac 1 1, \frac{1+3} 2, \frac{1+3+2} 3, \frac{1+3+2+6} 4, \frac{1+3+2+6+8} 5$$

in other words

$$\displaystyle 1, 2, 2, 3, 4$$

You are given the second sequence of integers $B$. Determine the first sequence of integers $A$ to check Mirko's calculations.

Input

The first line of input contains the integer $N$ $(1 \le N \le 100)$, the length of sequence $B$.

The second line of input contains the sequence of $N$ space-separated integers $B_i$ $(1 \le B_i \le 10^9)$.

Output

The first and only line of output must contain a sequence of $N$ space-separated integers $A_i$.

Please note: The input data will be such that the elements from the sequence $A$ are integers $(1 \le A_i \le 10^9)$.

Example 1

Input
1
2
Output
2

Example 2

Input
4
3 2 3 5
Output
3 1 5 11

Example 3

Input
5
1 2 2 3 4
Output
1 3 2 6 8
Source
COCI 2014/2015 Contest 1
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code