#C14964. Cumulative Sum

    ID: 44671 Type: Default 1000ms 256MiB

Cumulative Sum

Cumulative Sum

Given a sequence of integers, compute the cumulative sum. For each index \(i\), you are to calculate the cumulative sum \(s_i\) defined as:

[ s_i = \sum_{j=0}^{i} a_j ]

If the input list is empty, the output should be an empty line.

inputFormat

The input is given via stdin in the following format:

  • The first line contains an integer \(n\) indicating the number of elements in the list.
  • The second line contains \(n\) integers separated by spaces.

outputFormat

Output the cumulative sum sequence to stdout in one line. The numbers should be separated by a single space. If the list is empty, output an empty line.

## sample
3
1 2 3
1 3 6