#C5777. Cumulative Sum

    ID: 49463 Type: Default 1000ms 256MiB

Cumulative Sum

Cumulative Sum

Given an array of integers, compute a new array where the i-th element is the cumulative sum up to that index. In other words, if the input array is \(a_0, a_1, \dots, a_{n-1}\), you need to output an array \(b_0, b_1, \dots, b_{n-1}\) such that:

\(b_i = \sum_{j=0}^{i}a_j\)

The input is provided via standard input (stdin) and the output should be printed to standard output (stdout).

Example:

Input:
5
1 2 3 4 5

Output: 1 3 6 10 15

</p>

inputFormat

The first line of input contains a single integer \(n\) which is the number of elements in the array. If \(n > 0\), the second line contains \(n\) space-separated integers representing the array elements. If \(n = 0\), no further input is provided.

outputFormat

Output a single line containing \(n\) space-separated integers representing the cumulative sum of the input array. If the array is empty (i.e., \(n=0\)), print nothing.

## sample
5
1 2 3 4 5
1 3 6 10 15

</p>