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 xi to the first ai elements of the sequence. 
  2. Append an integer ki to the end of the sequence. (And hence the size of the sequence increases by 1) 
  3. 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!

Input

The first line contains a single integer n (1 ≤ n ≤ 2·105) — the number of operations. The next n lines describe the operations. Each line will start with an integer ti (1 ≤ ti ≤ 3), denoting the type of the operation (see above). If ti = 1, it will be followed by two integers ai, xi (|xi| ≤ 103; 1 ≤ ai). If ti = 2, it will be followed by a single integer ki (|ki| ≤ 103). If ti = 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.

Output

Output n lines each containing the average of the numbers in the sequence after the corresponding operation.

The answer will be considered correct if its absolute or relative error doesn't exceed 10 - 6.

Examples

Input

5
2 1
3
2 3
2 1
3


Output

0.500000
0.000000
1.500000
1.333333
1.500000


Input

6
2 1
1 2 20
2 2
1 2 -3
3
3


Output

0.500000
20.500000
14.333333
12.333333
17.500000
17.000000

Note

In the second sample, the sequence becomes <image>
import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class A implements Runnable {

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok;
	
	public static void main(String[] args) {
		new Thread(null, new A(), "", 64*1024*1024).start();
	}

	public void run() {
		try {
			long t1 = 0, t2 = 0;
			if (LOCAL) {
				t1 = System.currentTimeMillis();
			}
			Locale.setDefault(Locale.US);
			if (LOCAL) {
				in = new BufferedReader(new FileReader("input.txt"));
				out = new PrintWriter("output.txt");
			} else {
				in = new BufferedReader(new InputStreamReader(System.in));
				out = new PrintWriter(System.out);
			}
			tok = new StringTokenizer("");
			solve();
			in.close();
			out.close();
			if (LOCAL) {
				t2 = System.currentTimeMillis();
				System.err.println("Time = " + (t2 - t1) + " ms.");
			}
		} catch (Throwable e) {
			e.printStackTrace(System.err);
			throw new RuntimeException();
		}
	}

	String readString() throws IOException {
		while (!tok.hasMoreTokens()) {
			String line = in.readLine();
			if (line == null) return null;
			tok = new StringTokenizer(line);
		}
		return tok.nextToken();
	}
	
	int readInt() throws IOException {
		return Integer.parseInt(readString());
	}
	
	long readLong() throws IOException {
		return Long.parseLong(readString());
	}
	
	double readDouble() throws IOException {
		return Double.parseDouble(readString());
	}
	
	static class Mergesort {

		private Mergesort() {}

		public static void sort(int[] a) {
			mergesort(a, 0, a.length - 1);
		}

		public static void sort(long[] a) {
			mergesort(a, 0, a.length - 1);
		}

		public static void sort(double[] a) {
			mergesort(a, 0, a.length - 1);
		}

		private static final int MAGIC_VALUE = 42;

		private static void mergesort(int[] a, int leftIndex, int rightIndex) {
			if (leftIndex < rightIndex) {
				if (rightIndex - leftIndex <= MAGIC_VALUE) {
					insertionSort(a, leftIndex, rightIndex);
				} else {
					int middleIndex = (leftIndex + rightIndex) / 2;
					mergesort(a, leftIndex, middleIndex);
					mergesort(a, middleIndex + 1, rightIndex);
					merge(a, leftIndex, middleIndex, rightIndex);
				}
			}
		}

		private static void mergesort(long[] a, int leftIndex, int rightIndex) {
			if (leftIndex < rightIndex) {
				if (rightIndex - leftIndex <= MAGIC_VALUE) {
					insertionSort(a, leftIndex, rightIndex);
				} else {
					int middleIndex = (leftIndex + rightIndex) / 2;
					mergesort(a, leftIndex, middleIndex);
					mergesort(a, middleIndex + 1, rightIndex);
					merge(a, leftIndex, middleIndex, rightIndex);
				}
			}
		}

		private static void mergesort(double[] a, int leftIndex, int rightIndex) {
			if (leftIndex < rightIndex) {
				if (rightIndex - leftIndex <= MAGIC_VALUE) {
					insertionSort(a, leftIndex, rightIndex);
				} else {
					int middleIndex = (leftIndex + rightIndex) / 2;
					mergesort(a, leftIndex, middleIndex);
					mergesort(a, middleIndex + 1, rightIndex);
					merge(a, leftIndex, middleIndex, rightIndex);
				}
			}
		}

		private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {
			int length1 = middleIndex - leftIndex + 1;
			int length2 = rightIndex - middleIndex;
			int[] leftArray = new int[length1];
			int[] rightArray = new int[length2];
			System.arraycopy(a, leftIndex, leftArray, 0, length1);
			System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
			for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
				if (i == length1) {
					a[k] = rightArray[j++];
				} else if (j == length2) {
					a[k] = leftArray[i++];
				} else {
					a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
				}
			}
		}

		private static void merge(long[] a, int leftIndex, int middleIndex, int rightIndex) {
			int length1 = middleIndex - leftIndex + 1;
			int length2 = rightIndex - middleIndex;
			long[] leftArray = new long[length1];
			long[] rightArray = new long[length2];
			System.arraycopy(a, leftIndex, leftArray, 0, length1);
			System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
			for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
				if (i == length1) {
					a[k] = rightArray[j++];
				} else if (j == length2) {
					a[k] = leftArray[i++];
				} else {
					a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
				}
			}
		}

		private static void merge(double[] a, int leftIndex, int middleIndex, int rightIndex) {
			int length1 = middleIndex - leftIndex + 1;
			int length2 = rightIndex - middleIndex;
			double[] leftArray = new double[length1];
			double[] rightArray = new double[length2];
			System.arraycopy(a, leftIndex, leftArray, 0, length1);
			System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
			for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
				if (i == length1) {
					a[k] = rightArray[j++];
				} else if (j == length2) {
					a[k] = leftArray[i++];
				} else {
					a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
				}
			}
		}

		private static void insertionSort(int[] a, int leftIndex, int rightIndex) {
			for (int i = leftIndex + 1; i <= rightIndex; i++) {
				int current = a[i];
				int j = i - 1;
				while (j >= leftIndex && a[j] > current) {
					a[j + 1] = a[j];
					j--;
				}
				a[j + 1] = current;
			}
		}

		private static void insertionSort(long[] a, int leftIndex, int rightIndex) {
			for (int i = leftIndex + 1; i <= rightIndex; i++) {
				long current = a[i];
				int j = i - 1;
				while (j >= leftIndex && a[j] > current) {
					a[j + 1] = a[j];
					j--;
				}
				a[j + 1] = current;
			}
		}

		private static void insertionSort(double[] a, int leftIndex, int rightIndex) {
			for (int i = leftIndex + 1; i <= rightIndex; i++) {
				double current = a[i];
				int j = i - 1;
				while (j >= leftIndex && a[j] > current) {
					a[j + 1] = a[j];
					j--;
				}
				a[j + 1] = current;
			}
		}

	}
	
	void debug(Object... o) {
		if (LOCAL) {
			System.err.println(Arrays.deepToString(o));
		}
	}
	
	final static boolean LOCAL = System.getProperty("ONLINE_JUDGE") == null;//System.getProperty("os.name") != null && System.getProperty("os.name").contains("Windows");
	
//------------------------------------------------------------------------------

	class SegmentTree {		
		final int N = 200005;
		long[] sum = new long[4*N+5];
		long[] add = new long[4*N+5];
		boolean[] pushed = new boolean[4*N+5];
		boolean[] leaf = new boolean[4*N+5];
		
		void build(int tv, int tl, int tr) {
			pushed[tv] = true;
			if (tl == tr) {
				leaf[tv] = true;
				sum[tv] = 0;
				add[tv] = 0;
				return;
			}
			leaf[tv] = false;
			sum[tv] = 0;
			add[tv] = 0;
			int tm = (tl + tr) >> 1;
			build(2*tv, tl, tm);
			build(2*tv+1, tm+1, tr);
		}
		
		void inc(int tv, int tl, int tr, int L, int R, long d) {
			if (tl == L && tr == R) {
				add[tv] += d;
				pushed[tv] = false;
				return;
			}
			int tm = (tl + tr) >> 1;
			push(tv, tl, tm, tr);
			if (R <= tm) {
				inc(2*tv, tl, tm, L, R, d);
			} else if (tm+1 <= L) {
				inc(2*tv+1, tm+1, tr, L, R, d);
			} else {
				inc(2*tv, tl, tm, L, tm, d);
				inc(2*tv+1, tm+1, tr, tm+1, R, d);
			}
			update(tv, tl, tm, tr);
		}
		
		long getSum(int tv, int tl, int tr, int L, int R) {
			if (tl == L && tr == R) {
				return sum[tv] + add[tv]*(R-L+1);
			}
			int tm = (tl + tr) >> 1;
			push(tv, tl, tm, tr);
			if (R <= tm) {
				return getSum(2*tv, tl, tm, L, R);
			} else if (tm+1 <= L) {
				return getSum(2*tv+1, tm+1, tr, L, R);
			} else {
				long x1 = getSum(2*tv, tl, tm, L, tm);
				long x2 = getSum(2*tv+1, tm+1, tr, tm+1, R);
				return x1 + x2;
			}
		}
		
		void push(int tv, int tl, int tm, int tr) {
			if (pushed[tv]) return;
			pushed[tv] = true;
			long d = add[tv];
			add[tv] = 0;
			sum[tv] += d*(tr-tl+1);
			if (leaf[tv]) return;
			add[2*tv] += d;
			add[2*tv+1] += d;
			pushed[2*tv] = false;
			pushed[2*tv+1] = false;
		}
		
		void update(int tv, int tl, int tm, int tr) {
			sum[tv] = sum[2*tv] + add[2*tv]*(tm-tl+1) + sum[2*tv+1] + add[2*tv+1]*(tr-tm);
		}
	}
	
	void solve() throws IOException {
		int n = readInt();
		SegmentTree tree = new SegmentTree();
		tree.build(1, 0, tree.N-1);
		int size = 1;
		for (int i = 0; i < n; i++) {
			int t = readInt();
			if (t == 1) {
				int a = readInt();
				int x = readInt();
				tree.inc(1, 0, tree.N-1, 0, a-1, x);
			} else if (t == 2) {
				int k = readInt();
				tree.inc(1, 0, tree.N-1, size, size, k);
				size++;
			} else if (t == 3) {
				long last = tree.getSum(1, 0, tree.N-1, size-1, size-1);
				tree.inc(1, 0, tree.N-1, size-1, size-1, -last);
				size--;
			}
			/*for (int j = 0; j < size; j++) {
				out.print(tree.getSum(1, 0, tree.N-1, j, j) + " ");
			}
			out.println();/**/
			long sum = tree.getSum(1, 0, tree.N-1, 0, size-1);
			out.println(sum / (size + 0.0));
		}
	}
	
}
