Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/massiv-jamlangan-yigindilar

Running sums

Easy 1000 ms 128 MB 33%
Share

A positive integer $n$ and an array of $n$ integers are given. For every $i$ ($1 \le i \le n$), compute the sum of the first $i$ elements:

$$S_{i} = a_{1} + a_{2} + \dots + a_{i}$$

The prefix running sums of an array

Input

The first line contains a positive integer $n$. The second line contains $n$ integers separated by spaces.

Output

One line with $n$ integers separated by spaces: $S_{1}, S_{2}, \dots, S_{n}$.

Note

$1 \le n \le 10^{4}$
$-1000 \le a_{i} \le 1000$

Examples

Input #1
5
1 2 3 4 5
Output #1
1 3 6 10 15
Input #2
3
5 -5 5
Output #2
5 0 5

Sign in to submit a solution

Signing up is free and takes a minute.