IntermediateSimulation2000 ms256 MB

Bus Stop Simulation

Track passengers on a bus after a sequence of stops.

Statement

Track passengers on a bus after a sequence of stops.

Input

First line: starting passengers and number of stops. Next lines: passengers leaving and entering.

Output

Final passenger count.

Constraints

  • Passenger count never becomes negative.

Examples

Example 1

Input

10 3
2 5
4 1
3 2

Output

9

Start with 10 and apply each stop change.

Sample runs use visible examples. Full submissions are checked securely on the server, and private test cases are not shown in the browser.