Open the Books (Bank Ledger)

Starting from 0, read n lines deposit x or withdraw x and print the final balance (it may go negative).

Input: n, then n lines.

Output: The final balance.

Difficulty: Easy. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • One variable, updated per line.

More Bank Ledger practice