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.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class CF_174_C {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();

        BIT bit = new BIT(n+2);
        int size = 1;
        long sum = 0;
        int act = 0;

        for(int i=0; i<n; i++){
            act = sc.nextInt();
            if (act==1){
                int last = sc.nextInt();
                int a = sc.nextInt();
                sum+= last*a;
                bit.update(1, a);
                bit.update(last+1, -a);
            } else if (act==2){
                int num = sc.nextInt();
                bit.update(size+1, num);
                bit.update(size+2, -num);
                size++;
                sum+=num;                
            } else {
                int num = bit.getAcum(size+1-1);
                bit.update(size+1-1, -num);
                bit.update(size+1, num);
                size--;
                sum-=num;                
            }
            out.println(sum/(double)size);
        }
        out.close();
    }

    static class BIT {
        static int MaxVal;
        static int[] tree;

        BIT (int size){
            MaxVal = size;
            tree = new int[MaxVal+1];
        }

        /* Get the frequency of a the range 1-idx O(lg(n)) */
        int getAcum(int idx){
            int sum = 0;
            while (idx > 0){
                sum += tree[idx];
                idx -= (idx & -idx);
            }
            return sum;
        }

        /* Get the frequency of a single index O(lg(n)) */
        int get(int idx){
            int sum = tree[idx];
            if (idx > 0){
                int z = idx - (idx & -idx);
                idx--;
                while (idx != z){
                    sum -= tree[idx]; 
                    idx -= (idx & -idx);
                }
            }
            return sum;
        }

        /* Add val to the index idx O(lg(n)) */
        void update(int idx ,int val){
            while (idx <= MaxVal){
                tree[idx] += val;
                idx += (idx & -idx);
            }
        }

        /* Scale the tree by some factor O(n) */ 
        void scale(int c){
            for (int i = 1 ; i <= MaxVal ; i++)
                tree[i] = tree[i] / c;
        }

        /* if in tree exists more than one index with a same cumulative frequency,
         * this procedure will return some of them (we do not know which one) O(lg(n))
         *
         * bitMask - initialy, it is the greatest bit of MaxVal
         * bitMask store interval which should be searched  */
        int find(int cumFre){
            int idx = 0; // this var is result of function
            int bitMask = Integer.highestOneBit(MaxVal); 

            while ((bitMask != 0) && (idx < MaxVal)){ // nobody likes overflow :)
                int tIdx = idx + bitMask; // we make midpoint of interval
                if (cumFre == tree[tIdx]) // if it is equal, we just return idx
                    return tIdx;
                else if (cumFre > tree[tIdx]){ 
                    // if tree frequency "can fit" into cumFre,
                    // then include it
                    idx = tIdx; // update index 
                    cumFre -= tree[tIdx]; // set frequency for next loop 
                }
                bitMask >>= 1; // half current interval
            }
            if (cumFre != 0) // maybe given cumulative frequency doesn't exist
                return -1;
            else
                return idx;
        }

        /* if in tree exists more than one index with a same cumulative frequency,
         * this procedure will return the greatest one O(lg(n)) */
        int findG(int cumFre){
            int idx = 0;
            int bitMask = Integer.highestOneBit(MaxVal); 

            while ((bitMask != 0) && (idx < MaxVal)){
                int tIdx = idx + bitMask;
                if (cumFre >= tree[tIdx]){ 
                    // if current cumulative frequency is equal to cumFre, 
                    // we are still looking for higher index (if exists)
                    idx = tIdx;
                    cumFre -= tree[tIdx];
                }
                bitMask >>= 1;
            }
            if (cumFre != 0)
                return -1;
            else
                return idx;
        }

    }

    static public class InputReader {
        private boolean finished = false;

        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        
        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 peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar];
        }

        public int readInt() {
            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 - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

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

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return isWhitespace(c);
        }

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

        private String readLine0() {
            StringBuilder buf = new StringBuilder();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }

        public String readLine() {
            String s = readLine0();
            while (s.trim().length() == 0)
                s = readLine0();
            return s;
        }

        public String readLine(boolean ignoreEmptyLines) {
            if (ignoreEmptyLines)
                return readLine();
            else
                return readLine0();
        }

        public BigInteger readBigInteger() {
            try {
                return new BigInteger(readString());
            } catch (NumberFormatException e) {
                throw new InputMismatchException();
            }
        }

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

        public double readDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, readInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public boolean isExhausted() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value == -1;
        }

        public String next() {
            return readString();
        }

        public SpaceCharFilter getFilter() {
            return filter;
        }

        public void setFilter(SpaceCharFilter filter) {
            this.filter = filter;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
        
        double nextDouble(){
            return Double.parseDouble(next());
        }
    }

}
