408831: GYM103347 A Ophelia's Happiness
Description
Ophelia got asked out by Hamlet today! She is beyond jubilant and wants to celebrate. She goes to her personal garden and starts picking out roses for the occasion. Ophelia is curious about the total number of petals she has counted at certain points, and as such, starts counting the number of petals for each rose she picks. Unfortunately, Ophelia is quite poor at arithmetic, and wants you to help keep track of the total number of roses at any time.
Ophelia will give you a stream of queries of two types. The first type of query will be of the form $$$R\;c_i$$$, telling you that the $$$i^{th}$$$ rose has $$$c_i$$$ petals. The second type of query will be of the form $$$T$$$, where you must output the total number of petals.
InputThe first line will contain $$$n (1 \le n \le 10^5)$$$, the total number of queries that Ophelia has.
The next $$$n$$$ lines will each contain a query $$$R\;c_i$$$ (where $$$0 \le c_i \le 10^3$$$), or $$$T$$$.
OutputFor every query $$$T$$$, output the total number of rose petals counted up to that point on a separate line.
ExampleInput5 R 3 R 1 T R 2 TOutput
4 6