Bessie and the cows are playing with sequences and need your help. They start with a sequence, initially containing just the number 0, and perform *n* operations. Each operation is one of the following:
 1.  Add the integer *x*<sub class="lower-index">*i*</sub> to the first *a*<sub class="lower-index">*i*</sub> elements of the sequence. 1.  Append an integer *k*<sub class="lower-index">*i*</sub> to the end of the sequence. (And hence the size of the sequence increases by 1) 1.  Remove the last element of the sequence. So, the size of the sequence decreases by one. Note, that this operation can only be done if there are at least two elements in the sequence. 
After each operation, the cows would like to know the average of all the numbers in the sequence. Help them!
The first line contains a single integer *n* (1 ≤ *n* ≤ 2·10<sup class="upper-index">5</sup>) — the number of operations. The next *n* lines describe the operations. Each line will start with an integer *t*<sub class="lower-index">*i*</sub> (1 ≤ *t*<sub class="lower-index">*i*</sub> ≤ 3), denoting the type of the operation (see above). If *t*<sub class="lower-index">*i*</sub> = 1, it will be followed by two integers *a*<sub class="lower-index">*i*</sub>, *x*<sub class="lower-index">*i*</sub> (|*x*<sub class="lower-index">*i*</sub>| ≤ 10<sup class="upper-index">3</sup>; 1 ≤ *a*<sub class="lower-index">*i*</sub>). If *t*<sub class="lower-index">*i*</sub> = 2, it will be followed by a single integer *k*<sub class="lower-index">*i*</sub> (|*k*<sub class="lower-index">*i*</sub>| ≤ 10<sup class="upper-index">3</sup>). If *t*<sub class="lower-index">*i*</sub> = 3, it will not be followed by anything.

It is guaranteed that all operations are correct (don't touch nonexistent elements) and that there will always be at least one element in the sequence.
suma = 0.0
items = 0
puros = [0]
agreg = [0]
cant  = 1
queries = []
n = int(input())
for i in range(n):
  q = [int(x) for x in input().split()]
  if q[0] == 1:
    suma += q[1]*q[2]
    agreg[q[1]-1] += q[2]
  elif q[0] == 2:
    puros.append(q[1])
    agreg.append(0)
    suma += q[1]
    cant += 1
  else: #3
    cant -= 1
    agreg[-2] += agreg[-1]
    suma -= agreg.pop() + puros.pop()
  
  queries.append(suma/cant)
for q in queries:
  print("{0:.6f}".format(q))