Sum of a list

EasyBasicsArrays

Read a list of whole numbers and print their sum.

Input

The first line has n, how many numbers there are. The second line has the n numbers, separated by spaces.

Output

The sum of the numbers.

Constraints

  • 1 ≤ n ≤ 1000
  • Each number is between -1,000,000 and 1,000,000.

The input is read for you. The starter code puts it in variables; write your code under Your code here and print the answer. Changed the code already? Reset () brings the starter back.

Example 1

Input
4
1 2 3 4
Output
10
Why:

1 + 2 + 3 + 4 = 10.

Example 2

Input
3
-5 5 7
Output
7
Why:

-5 and 5 cancel out, leaving 7.

Hints

    Was this a good challenge?

    Solved by
    0
    Submissions
    0
    Accepted
    –