#C7952. Bank Account Operations

    ID: 51880 Type: Default 1000ms 256MiB

Bank Account Operations

Bank Account Operations

You are given a series of operations on a bank account. Initially, the account balance is \(0\). Each operation is provided in the form of a string: either "deposit X" or "withdraw X", where \(X\) is a positive integer.

For a deposit operation, the account balance increases by \(X\). For a withdraw operation, if the account has at least \(X\) in the balance, then \(X\) is deducted; otherwise, the balance remains unchanged.

Process all the operations and output the final balance.

inputFormat

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

  1. The first line contains an integer \(n\), representing the number of operations.
  2. The next \(n\) lines each contain a single operation in the format "deposit X" or "withdraw X".

outputFormat

Output a single integer (to stdout) that represents the final balance of the bank account after processing all operations.

## sample
6
deposit 100
withdraw 50
withdraw 10
deposit 70
withdraw 150
deposit 30
140