#C2434. Final Plant Size

    ID: 45750 Type: Default 1000ms 256MiB

Final Plant Size

Final Plant Size

You are given the initial size of a plant and a sequence of observations. Each observation represents how the plant changes over time, where (-1) indicates a decrease (shrink), (0) indicates no change, and (1) indicates an increase (grow). The final size of the plant is computed by the formula:

[ \text{final size} = \text{initial size} + \sum_{i=1}^{n} \Delta_i ]

For example, if the initial size is 5 and the observations are [1, 0, -1, 1, -1, 1], then the final size is computed as

(5 + (1+0-1+1-1+1) = 6).

inputFormat

Input is read from standard input. The first line contains an integer representing the initial size of the plant. The second line contains space-separated integers (each being -1, 0, or 1) representing the observations. If there are no observations, the second line will be empty.

outputFormat

Output the final size of the plant to standard output.## sample

5
1 0 -1 1 -1 1
6

</p>