408832: GYM103347 B Ophelia's Sadness

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Ophelia's Sadnesstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Ophelia got word that Hamlet has gone missing. Yesterday was supposed to be a date with Hamlet, and now Ophelia is saddened by the fact that not only was she abandoned by her date but also that she wouldn't be able to even see him in the near future. She is now sad. Ophelia goes to her personal garden and starts picking out roses in sadness. Ophelia is curious about the average 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 average 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 $$$A$$$, where you must output the average number of petals.

Input

The 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 $$$A$$$. It is guaranteed that a query $$$A$$$ will not be given when no roses have been counted.

Output

For every query $$$A$$$, output the average number of rose petals counted up to that point on a separate line. Your answer for each query will be correct if it is within an absolute or relative error of $$$10^{-6}$$$.

ExampleInput
5
R 3
R 2
A
R 5
A
Output
2.500000000
3.333333333

加入题单

算法标签: