Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

D. Half-decay tree

time limit per test

3 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputRecently Petya has become keen on physics. Anna V., his teacher noticed Petya's interest and gave him a fascinating physical puzzle — a half-decay tree.

A half-decay tree is a complete binary tree with the height *h*. The height of a tree is the length of the path (in edges) from the root to a leaf in the tree. While studying the tree Petya can add electrons to vertices or induce random decay with synchrophasotron. Random decay is a process during which the edges of some path from the root to the random leaf of the tree are deleted. All the leaves are equiprobable. As the half-decay tree is the school property, Petya will return back the deleted edges into the tree after each decay.

After being desintegrated, the tree decomposes into connected components. Charge of each component is the total quantity of electrons placed in vertices of the component. Potential of desintegerated tree is the maximum from the charges of its connected components. Each time before inducing random decay Petya is curious about the mathematical expectation of potential of the tree after being desintegrated.

Input

First line will contain two integers *h* and *q* (1 ≤ *h* ≤ 30, 1 ≤ *q* ≤ 10^{5}). Next *q* lines will contain a query of one of two types:

- add
*v**e*Petya adds

*e*electrons to vertex number*v*(1 ≤*v*≤ 2^{h + 1}- 1, 0 ≤*e*≤ 10^{4}).*v*and*e*are integers.The vertices of the tree are numbered in the following way: the root is numbered with 1, the children of the vertex with number

*x*are numbered with 2*x*and 2*x*+ 1. - decay
Petya induces tree decay.

Output

For each query decay solution you should output the mathematical expectation of potential of the tree after being desintegrated. The absolute or relative error in the answer should not exceed 10^{ - 4}.

Examples

Input

1 4

add 1 3

add 2 10

add 3 11

decay

Output

13.50000000

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/25/2017 17:32:58 (c2).

Desktop version, switch to mobile version.
User lists

Name |
---|