P29376 [洛谷] [COCI2014-2015#1] PROSJEK
普及-
题目描述

Problem Description

There is a sequence \( a \) and we are to derive another sequence \( b \) using the following formula:

\[ b_i = \frac{\sum_{j=1}^i a_j}{i} \]

Given the sequence \( b \), find the sequence \( a \).

Input Format

The first line contains an integer \( n \), representing the length of the sequence \( b \).

The next line contains \( n \) integers, representing the sequence \( b \).

Output Format

Output a single line containing \( n \) integers, representing the sequence \( a \).

Sample Input and Output

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

Notes

Explanation of Sample Input and Output #3

When the sequence \( a = 1, 3, 2, 6, 8 \), the sequence \( b \) is calculated as follows:

\[ b = \left( \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} \right) \]

Thus, \( b = 1, 2, 2, 3, 4 \).

Data Constraints

For \( 100\% \) of the data, it is guaranteed that \( 1 \leq n \leq 100 \) and \( 1 \leq a_i, b_i \leq 10^9 \).

Additional Notes

This problem is worth \( 50 \) points.

This problem is translated from the Croatian Open Competition in Informatics 2014/2015 Contest #1 T1 PROSJEK.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1 2
样例输出
2