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.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.Locale;
import java.io.OutputStream;
import java.util.RandomAccess;
import java.io.PrintWriter;
import java.util.AbstractList;
import java.io.Writer;
import java.util.List;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.math.BigInteger;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Jacob Jiang
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        int n = in.nextInt();
        Node[] nodes = new Node[n + 1];
        Arrays.fill(nodes, new Node(0, 1));
        SegmentTree tree = new SegmentTree(nodes);
        int len = 1;
        while (n-- > 0) {
            char type = in.nextChar();
            if (type == '1') {
                int a = in.nextInt();
                long x = in.nextInt();
                tree.changeOnRange(0, a - 1, x);
            } else if (type == '2') {
                long x = in.nextInt();
                long o = tree.requestOnPoint(len).sum;
                tree.changeOnPoint(len, x - o);
                len++;
            } else {
                len--;
            }
            out.println((double) tree.requestOnRange(0, len - 1).sum / len);
        }
    }

    private static Node NULL = new Node(0, 0);

    private static class Node {
        long sum;
        int length;

        private Node(long sum, int length) {
            this.sum = sum;
            this.length = length;
        }
    }

    private static class SegmentTree extends AbstractSegmentTree<Node, Long> {


        public SegmentTree(Node[] originData) {
            super(originData);
        }

        protected Node originData() {
            return NULL;
        }

        protected Long originTag() {
            return 0L;
        }

        protected Node joinData(Node left, Node right) {
            return new Node(left.sum + right.sum, left.length + right.length);
        }

        protected Long joinTag(Long first, Long second) {
            return first + second;
        }

        protected Node applyTag(Node data, Long tag) {
            return new Node(data.sum + tag * data.length, data.length);
        }
    }
}

class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1 << 16];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int nextInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c & 15;
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public static boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public char nextChar() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        return (char) c;
    }

    }

class OutputWriter {
    private PrintWriter writer;

    public OutputWriter(OutputStream stream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(stream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void println(double x) {
        writer.println(x);
    }

    public void close() {
        writer.close();
    }

    }

abstract class AbstractSegmentTree<Data, Tag> {
    private final int height;
    private final int size;
    private final Data[] data;
    private final Tag[] tag;

    protected abstract Data originData();

    protected abstract Tag originTag();

    protected abstract Data joinData(Data left, Data right);

    protected abstract Tag joinTag(Tag first, Tag second);

    protected abstract Data applyTag(Data data, Tag tag);

    public AbstractSegmentTree(int size) {
        if (size < 0)
            throw new IllegalArgumentException();
        this.size = size;
        height = NumberUtils.logTwoCeil(size + 2);
        int M = 1 << height;
        //noinspection unchecked
        data = (Data[]) new Object[M << 1];
        for (int i = M; i < M + M; i++) {
            data[i] = originData();
        }
        for (int i = M - 1; i >= 1; i--) {
            data[i] = joinData(data[i + i], data[i + i + 1]);
        }
        //noinspection unchecked
        tag = (Tag[]) new Object[M << 1];
        for (int i = 1; i < (M << 1); i++) {
            tag[i] = originTag();
        }
    }

    public AbstractSegmentTree(Data[] originData) {
        this.size = originData.length;
        height = NumberUtils.logTwoCeil(size + 2);
        int M = 1 << height;
        //noinspection unchecked
        data = (Data[]) new Object[M << 1];
        for (int i = M; i < M + M; i++) {
            if (i - M >= 1 && i - M <= size) data[i] = originData[i - M - 1];
            else data[i] = originData();
        }
        for (int i = M - 1; i >= 1; i--) {
            data[i] = joinData(data[i + i], data[i + i + 1]);
        }
        //noinspection unchecked
        tag = (Tag[]) new Object[M << 1];
        for (int i = 1; i < (M << 1); i++) {
            tag[i] = originTag();
        }
    }

    public AbstractSegmentTree(int size, Data originData) {
        this.size = size;
        height = NumberUtils.logTwoCeil(size + 2);
        int M = 1 << height;
        //noinspection unchecked
        data = (Data[]) new Object[M << 1];
        for (int i = M; i < M + M; i++) {
            if (i - M >= 1 && i - M <= size) data[i] = originData;
            else data[i] = originData();
        }
        for (int i = M - 1; i >= 1; i--) {
            data[i] = joinData(data[i + i], data[i + i + 1]);
        }
        //noinspection unchecked
        tag = (Tag[]) new Object[M << 1];
        for (int i = 1; i < (M << 1); i++) {
            tag[i] = originTag();
        }
    }

    private void addNewChange(int x, Tag p) {
        data[x] = applyTag(data[x], p);
        tag[x] = joinTag(tag[x], p);
    }

    private void pushToSon(int x) {
        addNewChange(x + x, tag[x]);
        addNewChange(x + x + 1, tag[x]);
        tag[x] = originTag();
    }


    private void pushToLeaf(int x) {
        for (int i = height; i > 0; i--) {
            pushToSon(x >> i);
        }
    }

    public void changeOnRange(int left, int right, Tag p) {
        checkRange(left, right);
        int M = 1 << height;
        left += M;
        right += M + 2;
        pushToLeaf(left);
        pushToLeaf(right);

        int left1 = left;
        int right1 = right;
        while (right - left > 1) {
            if ((left & 1) == 0)
                addNewChange(left + 1, p);
            if ((right & 1) == 1)
                addNewChange(right - 1, p);
            left >>= 1;
            right >>= 1;
        }

        for (int i = 0; i < height; i++) {
            left1 >>= 1;
            right1 >>= 1;
            data[left1] = joinData(data[left1 + left1], data[left1 + left1 + 1]);
            data[right1] = joinData(data[right1 + right1], data[right1 + right1 + 1]);
        }
    }

    public Data requestOnRange(int left, int right) {
        checkRange(left, right);
        int M = 1 << height;
        left += M;
        right += M + 2;
        pushToLeaf(left);
        pushToLeaf(right);

        Data leftResult = originData();
        Data rightResult = originData();

        while (right - left > 1) {
            if ((left & 1) == 0)
                leftResult = joinData(leftResult, data[left + 1]);
            if ((right & 1) == 1)
                rightResult = joinData(data[right - 1], rightResult);
            left >>= 1;
            right >>= 1;
        }
        return joinData(leftResult, rightResult);
    }

    public void changeOnPoint(int x, Tag p) {
        checkRange(x);
        int M = 1 << height;
        x += M + 1;
        pushToLeaf(x);
        addNewChange(x, p);
        for (int i = 0; i < height; i++) {
            x >>= 1;
            data[x] = joinData(data[x + x], data[x + x + 1]);
        }
    }

    public Data requestOnPoint(int x) {
        checkRange(x);
        int M = 1 << height;
        x += M + 1;
        pushToLeaf(x);
        return data[x];
    }

    private void checkRange(int x) {
        if (x < 0 || x >= size)
            throw new IllegalArgumentException();
    }


    private void checkRange(int left, int right) {
        if (left < 0 || left >= size || right < 0 || right >= size || left > right)
            throw new IllegalArgumentException();
    }
}

class NumberUtils {

    public static int twoPowerCeil(int num) {
        if (num < 0) throw new IllegalArgumentException();
        if (num == 0) return 1;
        int result = Integer.highestOneBit(num);
        if (result < num) result <<= 1;
        return result;
    }

    public static int logTwoCeil(int num) {
        return Integer.numberOfTrailingZeros(twoPowerCeil(num));
    }

    }

