Wolgok writes down every bit of income and spending by date. Managing that money matters a lot to him. He tried a ledger app on his phone, but he has lived so long that the app took forever to give him the number he wanted. Re-entering a record he had forgotten and recomputing was slow too, and Wolgok, who has no patience, smashed the phone. Write the program that helps him.
The program handles two operations. The first adds one income or spending entry on day p of Wolgok's life. Income arrives as a positive number and spending as a negative number. The second computes and prints how much the balance changed from day p through day q. Wolgok may be in debt, so the balance on some day i can be negative.