#K49337. Maximum Warehouse Weight

    ID: 28620 Type: Default 1000ms 256MiB

Maximum Warehouse Weight

Maximum Warehouse Weight

You are given a log representing events at a warehouse. Each event has a timestamp T, a weight W, and an operation which is either enter or exit. When an enter event occurs, the weight is added to the current warehouse total; when an exit event occurs, the weight is subtracted.

Your task is to process the events in the order given and determine the maximum total weight present in the warehouse at any moment. In mathematical terms, update the current weight as follows:

For an enter event: \(current\_weight += W\)
For an exit event: \(current\_weight -= W\)

Output the highest value reached by current_weight during the processing of the log entries.

inputFormat

The first line of input contains an integer N (the number of log entries). Each of the following N lines contains three items separated by spaces: an integer T (timestamp), an integer W (weight), and a string Op (either enter or exit).

outputFormat

Output a single integer: the maximum weight held by the warehouse at any time during the processing of the log.

## sample
5
1 100 enter
2 200 enter
3 150 enter
4 100 exit
5 150 exit
450