#K84907. Cumulative Turn Sum

    ID: 36523 Type: Default 1000ms 256MiB

Cumulative Turn Sum

Cumulative Turn Sum

You are given a list of integers where each integer represents the number of turns taken by a rider during a ride. Your task is to calculate the cumulative sum of turns. For each rider i, the final turn value is computed as:

$$S_i=\sum_{j=1}^{i} a_j$$

where \(a_j\) is the number of turns taken by the \(j^{th}\) rider. Compute the sequence \(S_1, S_2, \ldots, S_n\) and output the values separated by a single space.

inputFormat

The input is read from standard input (stdin) and has the following format:

  1. The first line contains a single integer \(n\) representing the number of riders.
  2. If \(n > 0\), the second line contains \(n\) space-separated integers \(a_1, a_2, \ldots, a_n\), where \(a_i\) represents the number of turns for the \(i^{th}\) rider.

outputFormat

Output a single line to standard output (stdout) containing \(n\) space-separated integers where the \(i^{th}\) integer is the cumulative sum up to that rider, i.e., \(S_i=\sum_{j=1}^{i} a_j\). If \(n=0\), output an empty line.

## sample
4
3 2 5 1
3 5 10 11