Problem A
Job Expenses

At ACME Corp, the seller Robin is selling software like hotcakes. To sell the software, he arranges meetings all over the country. Of course, he always needs to travel there, and sometimes even stay the night. Other times, he decides that a hot dog on the way to a meeting counts as accommodation.

Because Robin is very busy, he hasn’t been able to file his job expenses this month. Eret, the accountant, told him that he could fix it for him, as long as he got the price of all the expenses along with the receipts. Robin did this but misheard him: He has provided a list of all expenses and incomes he has brought in last month, with incomes as positive integers and expenses as negative integers.

Can you help Eret find out how much expenses Robin has paid for the last month?


The input consist of two lines: One line with the integer $N$, and one line with $N$ integers $k_ i$, representing the numbers Robin has written down.


Output the sum of all the expenses Robin has paid for the last month.


  • $0 \leq N \leq 20\, 000$

  • $-50\, 000 \leq k_ i\leq 500\, 000$ and $k_ i \neq 0$

Sample Input 1 Sample Output 1
1 -2 3
Sample Input 2 Sample Output 2
129 44 394 253 147
Sample Input 3 Sample Output 3
-100 40000 -6500 -230 -18 34500 -450 13000 -100 5000

Please log in to submit a solution to this problem

Log in