#C7015. Budget Operations Processing

    ID: 50840 Type: Default 1000ms 256MiB

Budget Operations Processing

Budget Operations Processing

You are given a series of operations that modify a budget. Initially, the budget is \(0\). Each operation is provided as a string containing one or more commands separated by spaces. A command is formatted as \(+x\) or \(-y\) where \(x\) and \(y\) are positive integers. When processing an operation, apply the commands sequentially. If at any point the budget becomes negative after subtracting, it should immediately be reset to \(0\).

Your task is to output the final budget after each operation.

inputFormat

The input is read from standard input (stdin). The first line contains a single integer \(n\), representing the number of operations. The next \(n\) lines each contain a string that represents an operation. Each operation consists of space-separated commands in the form of \(+x\) or \(-y\) where \(x\) and \(y\) are positive integers.

outputFormat

For each operation, output the final budget value (after processing all commands) on its own line to standard output (stdout).

## sample
1
+1000
1000

</p>