#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unistd.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int, int >pii;
typedef vector < int >vi;
typedef vector < pii > vpii;
typedef pair < ll, ll > pll;
typedef vector < ll > vl;
typedef vector < pll > vpll;

#ifndef ONLINE_JUDGE
FILE *__redirect__ = freopen("in", "r", stdin);
#  include <bits/stdc++.h>
#else
#  include <bits/stdc++.h>
#endif

#define lsb(x) (x&-x)
#define del(x) if(x) delete x

#define rep(i,a,b) for(int i = a; i < b; ++i)
#define repq(i,a,b) for(int i = a; i <= b; ++i)

#define rev(i,a,b) for(int i = a; i >= b; --i)
#define revn(i,a,b) for(int i = a; i > b; --i)

#define repc(i,a,cond) for(int i = a; cond; ++i)
#define revc(i,a,cond) for(int i = a; cond; --i)

#define all(x) (x.begin(),x.end())
#define rall(x) (x.rbegin(),x.rend())

#define pb push_back
#define eb pb
//emplace_back
#define mp make_pair

int INF = 1e9;
int const N = 2e5 + 16;
int const M = 1e9 + 7;

template < class t > void sc(t & x) {
  x = 0;
  int c = 0, z = 0, sign = 1;
  while (!isdigit(c = getchar()))
    z = c;
  if (z == '-')
    sign = -1;
  x = c - '0';
  while (isdigit(c = getchar()))
    x = (x << 1) + (x << 3) + c - '0';
  x *= sign;
}

template < class t > void put(t x) {
  static char buf[32] = { };
  if (x == 0) {
    putchar('0');
    return;
  }
  int i = 32;
  if (x < 0)
    putchar('-'), x = -x;
  do
    buf[--i] = x % 10 + '0';
  while (x /= 10);
  while (i < 32)
    putchar(buf[i++]);
}

int n;
int a[N];
int u[N];

int main() {
  sc(n);
  int len = 1;
  ll sum = 0;
  while(n--) {
    int t; sc(t);
    if(t == 1) {
      int x, y; sc(x), sc(y);
      a[x] += y;
      sum += x*y;
    } else if(t == 2) {
      int x; sc(x);
      a[++len] = x;
      sum += x;
    } else {
      u[len-1] += u[len];
      sum -= a[len]-u[len];
      --len;
    }

    printf("%.10f\n", sum/double(len));
  }
}


#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unistd.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int, int >pii;
typedef vector < int >vi;
typedef vector < pii > vpii;
typedef pair < ll, ll > pll;
typedef vector < ll > vl;
typedef vector < pll > vpll;

#ifndef ONLINE_JUDGE
FILE *__redirect__ = freopen("in", "r", stdin);
#  include <bits/stdc++.h>
#else
#  include <bits/stdc++.h>
#endif

#define lsb(x) (x&-x)
#define del(x) if(x) delete x

#define rep(i,a,b) for(int i = a; i < b; ++i)
#define repq(i,a,b) for(int i = a; i <= b; ++i)

#define rev(i,a,b) for(int i = a; i >= b; --i)
#define revn(i,a,b) for(int i = a; i > b; --i)

#define repc(i,a,cond) for(int i = a; cond; ++i)
#define revc(i,a,cond) for(int i = a; cond; --i)

#define all(x) (x.begin(),x.end())
#define rall(x) (x.rbegin(),x.rend())

#define pb push_back
#define eb pb
//emplace_back
#define mp make_pair

int INF = 1e9;
int const N = 2e5 + 16;
int const M = 1e9 + 7;

template < class t > void sc(t & x) {
  x = 0;
  int c = 0, z = 0, sign = 1;
  while (!isdigit(c = getchar()))
    z = c;
  if (z == '-')
    sign = -1;
  x = c - '0';
  while (isdigit(c = getchar()))
    x = (x << 1) + (x << 3) + c - '0';
  x *= sign;
}

template < class t > void put(t x) {
  static char buf[32] = { };
  if (x == 0) {
    putchar('0');
    return;
  }
  int i = 32;
  if (x < 0)
    putchar('-'), x = -x;
  do
    buf[--i] = x % 10 + '0';
  while (x /= 10);
  while (i < 32)
    putchar(buf[i++]);
}

int n;
int logn;
int cnt[N+N];
ll tree[N+N];
ll z[N+N];

void build() {
  logn = 18;
  rep(i,0,N)
    cnt[i+N] = 1;
  revn(i,N-1,0)
    cnt[i] = cnt[i<<1]+cnt[i<<1|1];
}

void apply(int i, ll v) {
  tree[i] += v;
  if(i < n)
    z[i] += v;
}

void up(int i) {
  while(i>>=1)
    tree[i] = tree[i<<1]+tree[i<<1|1]+cnt[i]*z[i];
}

void push(int i) {
  for(int p = logn; p; --p) {
    int x = i >> p;
    if(z[x]) {
      apply(x<<1,z[x]);
      apply(x<<1|1,z[x]);
      z[x] = 0;
    }
  }
}

void update(int l, int r, ll v) {
  push(l += N);
  push(r += N);
  int lx = l, rx = r;
  ll sum = 0;
  for(;l <= r; l >>= 1, r >>= 1) {
    if(l&1)
      apply(l++, v);
    if((r&1)==0)
      apply(r--, v);
  }
  up(lx);
  up(rx);
}

ll query(int l, int r) {
  push(l += N);
  push(r += N);
  ll sum = 0;
  for(;l <= r; l >>= 1, r >>= 1) {
    if(l&1)
      sum += tree[l++];
    if((r&1)==0)
      sum += tree[r--];
  }
  return sum;
}

int main() {
  scanf("%d",&n);
  int len = 1;
  ll sum = 0;
  while(n--) {
    int t; scanf("%d",&t);
    if(t == 1) {
      int x, y; scanf("%d%d",&x,&y);
      update(1,x,y);
    } else if(t == 2) {
      int x; scanf("%d",&x);
      ++len;
      update(len,len,x);
    } else {
      update(len,len,-query(len,len));
      --len;
    }

    printf("%.10f\n", (double)query(1,len)/len);
  }
}


#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unistd.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int, int >pii;
typedef vector < int >vi;
typedef vector < pii > vpii;
typedef pair < ll, ll > pll;
typedef vector < ll > vl;
typedef vector < pll > vpll;

#ifndef ONLINE_JUDGE
FILE *__redirect__ = freopen("in", "r", stdin);
#  include <bits/stdc++.h>
#else
#  include <bits/stdc++.h>
#endif

#define lsb(x) (x&-x)
#define del(x) if(x) delete x

#define rep(i,a,b) for(int i = a; i < b; ++i)
#define repq(i,a,b) for(int i = a; i <= b; ++i)

#define rev(i,a,b) for(int i = a; i >= b; --i)
#define revn(i,a,b) for(int i = a; i > b; --i)

#define repc(i,a,cond) for(int i = a; cond; ++i)
#define revc(i,a,cond) for(int i = a; cond; --i)

#define all(x) (x.begin(),x.end())
#define rall(x) (x.rbegin(),x.rend())

#define pb push_back
#define eb pb
//emplace_back
#define mp make_pair

int INF = 1e9;
int const N = 2e5 + 16;
int const M = 1e9 + 7;

template < class t > void sc(t & x) {
  x = 0;
  int c = 0, z = 0, sign = 1;
  while (!isdigit(c = getchar()))
    z = c;
  if (z == '-')
    sign = -1;
  x = c - '0';
  while (isdigit(c = getchar()))
    x = (x << 1) + (x << 3) + c - '0';
  x *= sign;
}

template < class t > void put(t x) {
  static char buf[32] = { };
  if (x == 0) {
    putchar('0');
    return;
  }
  int i = 32;
  if (x < 0)
    putchar('-'), x = -x;
  do
    buf[--i] = x % 10 + '0';
  while (x /= 10);
  while (i < 32)
    putchar(buf[i++]);
}

int n;
int a[N];
int u[N];

int main() {
  sc(n);
  int len = 1;
  ll sum = 0;
  while(n--) {
    int t; sc(t);
    if(t == 1) {
      int x, y; sc(x), sc(y);
      a[x] += y;
      sum += x*y;
    } else if(t == 2) {
      int x; sc(x);
      a[++len] = x;
      sum += x;
    } else {
      u[len-1] += u[len];
      sum -= a[len]-u[len];
      --len;
    }

    printf("%.8f\n", sum/double(len));
  }
}


#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unistd.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int, int >pii;
typedef vector < int >vi;
typedef vector < pii > vpii;
typedef pair < ll, ll > pll;
typedef vector < ll > vl;
typedef vector < pll > vpll;

#ifndef ONLINE_JUDGE
FILE *__redirect__ = freopen("in", "r", stdin);
#  include <bits/stdc++.h>
#else
#  include <bits/stdc++.h>
#endif

#define lsb(x) (x&-x)
#define del(x) if(x) delete x

#define rep(i,a,b) for(int i = a; i < b; ++i)
#define repq(i,a,b) for(int i = a; i <= b; ++i)

#define rev(i,a,b) for(int i = a; i >= b; --i)
#define revn(i,a,b) for(int i = a; i > b; --i)

#define repc(i,a,cond) for(int i = a; cond; ++i)
#define revc(i,a,cond) for(int i = a; cond; --i)

#define all(x) (x.begin(),x.end())
#define rall(x) (x.rbegin(),x.rend())

#define pb push_back
#define eb pb
//emplace_back
#define mp make_pair

int INF = 1e9;
int const N = 2e5 + 16;
int const M = 1e9 + 7;

template < class t > void sc(t & x) {
  x = 0;
  int c = 0, z = 0, sign = 1;
  while (!isdigit(c = getchar()))
    z = c;
  if (z == '-')
    sign = -1;
  x = c - '0';
  while (isdigit(c = getchar()))
    x = (x << 1) + (x << 3) + c - '0';
  x *= sign;
}

template < class t > void put(t x) {
  static char buf[32] = { };
  if (x == 0) {
    putchar('0');
    return;
  }
  int i = 32;
  if (x < 0)
    putchar('-'), x = -x;
  do
    buf[--i] = x % 10 + '0';
  while (x /= 10);
  while (i < 32)
    putchar(buf[i++]);
}

int n;
int logn;
int cnt[N+N];
ll tree[N+N];
ll z[N+N];

void build() {
  logn = 18;
  rep(i,0,N)
    cnt[i+N] = 1;
  revn(i,N-1,0)
    cnt[i] = cnt[i<<1]+cnt[i<<1|1];
}

void apply(int i, ll v) {
  tree[i] += v;
  if(i < N)
    z[i] += v;
}

void up(int i) {
  while(i>>=1)
    tree[i] = tree[i<<1]+tree[i<<1|1]+cnt[i]*z[i];
}

void push(int i) {
  for(int p = logn; p; --p) {
    int x = i >> p;
    if(z[x]) {
      apply(x<<1,z[x]);
      apply(x<<1|1,z[x]);
      z[x] = 0;
    }
  }
}

void update(int l, int r, ll v) {
  push(l += N);
  push(r += N);
  int lx = l, rx = r;
  ll sum = 0;
  for(;l <= r; l >>= 1, r >>= 1) {
    if(l&1)
      apply(l++, v);
    if((r&1)==0)
      apply(r--, v);
  }
  up(lx);
  up(rx);
}

ll query(int l, int r) {
  push(l += N);
  push(r += N);
  ll sum = 0;
  for(;l <= r; l >>= 1, r >>= 1) {
    if(l&1)
      sum += tree[l++];
    if((r&1)==0)
      sum += tree[r--];
  }
  return sum;
}

int main() {
  scanf("%d",&n);
  int len = 1;
  ll sum = 0;
  build();
  while(n--) {
    int t; scanf("%d",&t);
    if(t == 1) {
      int x, y; scanf("%d%d",&x,&y);
      update(1,x,y);
    } else if(t == 2) {
      int x; scanf("%d",&x);
      ++len;
      update(len,len,x);
    } else {
      update(len,len,-query(len,len));
      --len;
    }

    printf("%.10f\n", (double)query(1,len)/len);
  }
}


#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unistd.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int, int >pii;
typedef vector < int >vi;
typedef vector < pii > vpii;
typedef pair < ll, ll > pll;
typedef vector < ll > vl;
typedef vector < pll > vpll;

#ifndef ONLINE_JUDGE
FILE *__redirect__ = freopen("in", "r", stdin);
#  include <bits/stdc++.h>
#else
#  include <bits/stdc++.h>
#endif

#define lsb(x) (x&-x)
#define del(x) if(x) delete x

#define rep(i,a,b) for(int i = a; i < b; ++i)
#define repq(i,a,b) for(int i = a; i <= b; ++i)

#define rev(i,a,b) for(int i = a; i >= b; --i)
#define revn(i,a,b) for(int i = a; i > b; --i)

#define repc(i,a,cond) for(int i = a; cond; ++i)
#define revc(i,a,cond) for(int i = a; cond; --i)

#define all(x) (x.begin(),x.end())
#define rall(x) (x.rbegin(),x.rend())

#define pb push_back
#define eb pb
//emplace_back
#define mp make_pair

int INF = 1e9;
int const N = 2e5 + 16;
int const M = 1e9 + 7;

template < class t > void sc(t & x) {
  x = 0;
  int c = 0, z = 0, sign = 1;
  while (!isdigit(c = getchar()))
    z = c;
  if (z == '-')
    sign = -1;
  x = c - '0';
  while (isdigit(c = getchar()))
    x = (x << 1) + (x << 3) + c - '0';
  x *= sign;
}

template < class t > void put(t x) {
  static char buf[32] = { };
  if (x == 0) {
    putchar('0');
    return;
  }
  int i = 32;
  if (x < 0)
    putchar('-'), x = -x;
  do
    buf[--i] = x % 10 + '0';
  while (x /= 10);
  while (i < 32)
    putchar(buf[i++]);
}

int n;
int logn;
int cnt[N+N+16];
ll tree[N+N+16];
ll z[N+16];

void build() {
  logn = 18;
  fill(cnt+N,cnt+N+N,1);
  revn(i,N-1,0)
    cnt[i] = cnt[i<<1]+cnt[i<<1|1];
}

void apply(int i, ll v) {
  tree[i] += v;
  if(i < N)
    z[i] += v;
}

void up(int i) {
  while(i>>=1)
    tree[i] = tree[i<<1]+tree[i<<1|1]+cnt[i]*z[i];
}

void push(int i) {
  for(int p = logn; p; --p) {
    int x = i >> p;
    if(z[x]) {
      apply(x<<1,z[x]);
      apply(x<<1|1,z[x]);
      z[x] = 0;
    }
  }
}

void update(int l, int r, ll v) {
  push(l += N);
  push(r += N);
  int lx = l, rx = r;
  ll sum = 0;
  for(;l <= r; l >>= 1, r >>= 1) {
    if(l&1)
      apply(l++, v);
    if((r&1)==0)
      apply(r--, v);
  }
  up(lx);
  up(rx);
}

ll query(int l, int r) {
  push(l += N);
  push(r += N);
  ll sum = 0;
  for(;l <= r; l >>= 1, r >>= 1) {
    if(l&1)
      sum += tree[l++];
    if((r&1)==0)
      sum += tree[r--];
  }
  return sum;
}

int main() {
  scanf("%d",&n);
  int len = 1;
  ll sum = 0;
  build();
  while(n--) {
    int t; scanf("%d",&t);
    if(t == 1) {
      int x, y; scanf("%d%d",&x,&y);
      update(1,x,y);
    } else if(t == 2) {
      int x; scanf("%d",&x);
      ++len;
      update(len,len,x);
    } else {
      update(len,len,-query(len,len));
      --len;
    }

    printf("%.6f\n", query(1,len)/double(len));
  }
}


#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unistd.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int, int >pii;
typedef vector < int >vi;
typedef vector < pii > vpii;
typedef pair < ll, ll > pll;
typedef vector < ll > vl;
typedef vector < pll > vpll;

#ifndef ONLINE_JUDGE
FILE *__redirect__ = freopen("in", "r", stdin);
#  include <bits/stdc++.h>
#else
#  include <bits/stdc++.h>
#endif

#define lsb(x) (x&-x)
#define del(x) if(x) delete x

#define rep(i,a,b) for(int i = a; i < b; ++i)
#define repq(i,a,b) for(int i = a; i <= b; ++i)

#define rev(i,a,b) for(int i = a; i >= b; --i)
#define revn(i,a,b) for(int i = a; i > b; --i)

#define repc(i,a,cond) for(int i = a; cond; ++i)
#define revc(i,a,cond) for(int i = a; cond; --i)

#define all(x) (x.begin(),x.end())
#define rall(x) (x.rbegin(),x.rend())

#define pb push_back
#define eb pb
//emplace_back
#define mp make_pair

int INF = 1e9;
int const N = 2e5 + 16;
int const M = 1e9 + 7;

template < class t > void sc(t & x) {
  x = 0;
  int c = 0, z = 0, sign = 1;
  while (!isdigit(c = getchar()))
    z = c;
  if (z == '-')
    sign = -1;
  x = c - '0';
  while (isdigit(c = getchar()))
    x = (x << 1) + (x << 3) + c - '0';
  x *= sign;
}

template < class t > void put(t x) {
  static char buf[32] = { };
  if (x == 0) {
    putchar('0');
    return;
  }
  int i = 32;
  if (x < 0)
    putchar('-'), x = -x;
  do
    buf[--i] = x % 10 + '0';
  while (x /= 10);
  while (i < 32)
    putchar(buf[i++]);
}

int n;
int a[N];
int b[N];

int main() {
  scanf("%d",&n);
  int len = 1;
  ll sum = 0;
  while(n--) {
    int t; sc(t);
    if(t == 1) {
      int x, y; sc(x), sc(y);
      b[x] += y;
      sum += x*y;
    } else if(t == 2) {
      int x; sc(x);
      a[++len] = x;
      sum += x;
    } else {
      b[len-1] += b[len];
      sum -= a[len] + b[len];
      // zero after yourself :D
      a[len] = b[len] = 0;
      --len;
    }

    printf("%.6f\n", sum/double(len));
  }
}


#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unistd.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int, int >pii;
typedef vector < int >vi;
typedef vector < pii > vpii;
typedef pair < ll, ll > pll;
typedef vector < ll > vl;
typedef vector < pll > vpll;

#ifndef ONLINE_JUDGE
FILE *__redirect__ = freopen("in", "r", stdin);
#  include <bits/stdc++.h>
#else
#  include <bits/stdc++.h>
#endif

#define lsb(x) (x&-x)
#define del(x) if(x) delete x

#define rep(i,a,b) for(int i = a; i < b; ++i)
#define repq(i,a,b) for(int i = a; i <= b; ++i)

#define rev(i,a,b) for(int i = a; i >= b; --i)
#define revn(i,a,b) for(int i = a; i > b; --i)

#define repc(i,a,cond) for(int i = a; cond; ++i)
#define revc(i,a,cond) for(int i = a; cond; --i)

#define all(x) (x.begin(),x.end())
#define rall(x) (x.rbegin(),x.rend())

#define pb push_back
#define eb pb
//emplace_back
#define mp make_pair

int INF = 1e9;
int const N = 2e5 + 16;
int const M = 1e9 + 7;

template < class t > void sc(t & x) {
  x = 0;
  int c = 0, z = 0, sign = 1;
  while (!isdigit(c = getchar()))
    z = c;
  if (z == '-')
    sign = -1;
  x = c - '0';
  while (isdigit(c = getchar()))
    x = (x << 1) + (x << 3) + c - '0';
  x *= sign;
}

template < class t > void put(t x) {
  static char buf[32] = { };
  if (x == 0) {
    putchar('0');
    return;
  }
  int i = 32;
  if (x < 0)
    putchar('-'), x = -x;
  do
    buf[--i] = x % 10 + '0';
  while (x /= 10);
  while (i < 32)
    putchar(buf[i++]);
}

int n;
int logn;
int cnt[N+N+16];
ll tree[N+N+16];
ll z[N+16];

void build() {
  logn = 18;
  fill(cnt+N,cnt+N+N,1);
  revn(i,N-1,0)
    cnt[i] = cnt[i<<1]+cnt[i<<1|1];
}

void apply(int i, ll v) {
  tree[i] += v;
  if(i < N)
    z[i] += v;
}

void up(int i) {
  while(i>>=1)
    tree[i] = tree[i<<1]+tree[i<<1|1]+cnt[i]*z[i];
}

void push(int i) {
  for(int p = logn; p; --p) {
    int x = i >> p;
    if(z[x]) {
      apply(x<<1,z[x]);
      apply(x<<1|1,z[x]);
      z[x] = 0;
    }
  }
}

void update(int l, int r, ll v) {
  push(l += N);
  push(r += N);
  int lx = l, rx = r;
  ll sum = 0;
  for(;l <= r; l >>= 1, r >>= 1) {
    if(l&1)
      apply(l++, v);
    if((r&1)==0)
      apply(r--, v);
  }
  up(lx);
  up(rx);
}

ll query(int l, int r) {
  push(l += N);
  push(r += N);
  ll sum = 0;
  for(;l <= r; l >>= 1, r >>= 1) {
    if(l&1)
      sum += tree[l++];
    if((r&1)==0)
      sum += tree[r--];
  }
  return sum;
}

int main() {
  scanf("%d",&n);
  int len = 0;
  ll sum = 0;
  build();
  while(n--) {
    int t; scanf("%d",&t);
    if(t == 1) {
      int x, y; scanf("%d%d",&x,&y);
      update(0,x-1,y);
      len = max(x-1,len);
    } else if(t == 2) {
      int x; scanf("%d",&x);
      ++len;
      update(len,len,x);
    } else {
      update(len,len,-query(len,len));
      --len;
    }

    printf("%.6f\n", query(0,len)/double(len+1));
  }
}


#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unistd.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int, int >pii;
typedef vector < int >vi;
typedef vector < pii > vpii;
typedef pair < ll, ll > pll;
typedef vector < ll > vl;
typedef vector < pll > vpll;

#ifndef ONLINE_JUDGE
FILE *__redirect__ = freopen("in", "r", stdin);
#  include <bits/stdc++.h>
#else
#  include <bits/stdc++.h>
#endif

#define lsb(x) (x&-x)
#define del(x) if(x) delete x

#define rep(i,a,b) for(int i = a; i < b; ++i)
#define repq(i,a,b) for(int i = a; i <= b; ++i)

#define rev(i,a,b) for(int i = a; i >= b; --i)
#define revn(i,a,b) for(int i = a; i > b; --i)

#define repc(i,a,cond) for(int i = a; cond; ++i)
#define revc(i,a,cond) for(int i = a; cond; --i)

#define all(x) (x.begin(),x.end())
#define rall(x) (x.rbegin(),x.rend())

#define pb push_back
#define eb pb
//emplace_back
#define mp make_pair

int INF = 1e9;
int const N = 2e5 + 16;
int const M = 1e9 + 7;

template < class t > void sc(t & x) {
  x = 0;
  int c = 0, z = 0, sign = 1;
  while (!isdigit(c = getchar()))
    z = c;
  if (z == '-')
    sign = -1;
  x = c - '0';
  while (isdigit(c = getchar()))
    x = (x << 1) + (x << 3) + c - '0';
  x *= sign;
}

template < class t > void put(t x) {
  static char buf[32] = { };
  if (x == 0) {
    putchar('0');
    return;
  }
  int i = 32;
  if (x < 0)
    putchar('-'), x = -x;
  do
    buf[--i] = x % 10 + '0';
  while (x /= 10);
  while (i < 32)
    putchar(buf[i++]);
}

int n;
int a[N];
int b[N];

int main() {
  sc(n);
  int len = 1;
  int sum = 0;
  while(n--) {
    int t; sc(t);
    if(t == 1) {
      int x, y; sc(x), sc(y);
      b[x] += y;
      sum += x*y;
    } else if(t == 2) {
      int x; sc(x);
      a[++len] = x;
      sum += x;
    } else {
      b[len-1] += b[len];
      sum -= a[len] + b[len];
      // zero after yourself :D
      a[len] = b[len] = 0;
      --len;
    }

    printf("%.7f\n", sum/double(len));
  }
}


#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unistd.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int, int >pii;
typedef vector < int >vi;
typedef vector < pii > vpii;
typedef pair < ll, ll > pll;
typedef vector < ll > vl;
typedef vector < pll > vpll;

#ifndef ONLINE_JUDGE
FILE *__redirect__ = freopen("in", "r", stdin);
#  include <bits/stdc++.h>
#else
#  include <bits/stdc++.h>
#endif

#define lsb(x) (x&-x)
#define del(x) if(x) delete x

#define rep(i,a,b) for(int i = a; i < b; ++i)
#define repq(i,a,b) for(int i = a; i <= b; ++i)

#define rev(i,a,b) for(int i = a; i >= b; --i)
#define revn(i,a,b) for(int i = a; i > b; --i)

#define repc(i,a,cond) for(int i = a; cond; ++i)
#define revc(i,a,cond) for(int i = a; cond; --i)

#define all(x) (x.begin(),x.end())
#define rall(x) (x.rbegin(),x.rend())

#define pb push_back
#define eb pb
//emplace_back
#define mp make_pair

int INF = 1e9;
int const N = 2e5 + 16;
int const M = 1e9 + 7;

template < class t > void sc(t & x) {
  x = 0;
  int c = 0, z = 0, sign = 1;
  while (!isdigit(c = getchar()))
    z = c;
  if (z == '-')
    sign = -1;
  x = c - '0';
  while (isdigit(c = getchar()))
    x = (x << 1) + (x << 3) + c - '0';
  x *= sign;
}

template < class t > void put(t x) {
  static char buf[32] = { };
  if (x == 0) {
    putchar('0');
    return;
  }
  int i = 32;
  if (x < 0)
    putchar('-'), x = -x;
  do
    buf[--i] = x % 10 + '0';
  while (x /= 10);
  while (i < 32)
    putchar(buf[i++]);
}

int n;
int logn;
int cnt[N+N+16];
ll tree[N+N+16];
ll z[N+16];

void build() {
  logn = 18;
  fill(cnt+N,cnt+N+N,1);
  revn(i,N-1,0)
    cnt[i] = cnt[i<<1]+cnt[i<<1|1];
}

void apply(int i, ll v) {
  tree[i] += v;
  if(i < N)
    z[i] += v;
}

void up(int i) {
  while(i>>=1)
    tree[i] = tree[i<<1]+tree[i<<1|1]+cnt[i]*z[i];
}

void push(int i) {
  for(int p = logn; p; --p) {
    int x = i >> p;
    if(z[x]) {
      apply(x<<1,z[x]);
      apply(x<<1|1,z[x]);
      z[x] = 0;
    }
  }
}

void update(int l, int r, ll v) {
  push(l += N);
  push(r += N);
  int lx = l, rx = r;
  ll sum = 0;
  for(;l <= r; l >>= 1, r >>= 1) {
    if(l&1)
      apply(l++, v);
    if((r&1)==0)
      apply(r--, v);
  }
  up(lx);
  up(rx);
}

ll query(int l, int r) {
  push(l += N);
  push(r += N);
  ll sum = 0;
  for(;l <= r; l >>= 1, r >>= 1) {
    if(l&1)
      sum += tree[l++];
    if((r&1)==0)
      sum += tree[r--];
  }
  return sum;
}

int main() {
  scanf("%d",&n);
  int len = 1;
  ll sum = 0;
  build();
  while(n--) {
    int t; scanf("%d",&t);
    if(t == 1) {
      int x, y; scanf("%d%d",&x,&y);
      update(1,x,y);
    } else if(t == 2) {
      int x; scanf("%d",&x);
      ++len;
      update(len,len,x);
    } else {
      update(len,len,-query(len,len));
      --len;
    }

    printf("%.10f\n", (double)query(1,len)/len);
  }
}


#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unistd.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int, int >pii;
typedef vector < int >vi;
typedef vector < pii > vpii;
typedef pair < ll, ll > pll;
typedef vector < ll > vl;
typedef vector < pll > vpll;

#ifndef ONLINE_JUDGE
FILE *__redirect__ = freopen("in", "r", stdin);
#  include <bits/stdc++.h>
#else
#  include <bits/stdc++.h>
#endif

#define lsb(x) (x&-x)
#define del(x) if(x) delete x

#define rep(i,a,b) for(int i = a; i < b; ++i)
#define repq(i,a,b) for(int i = a; i <= b; ++i)

#define rev(i,a,b) for(int i = a; i >= b; --i)
#define revn(i,a,b) for(int i = a; i > b; --i)

#define repc(i,a,cond) for(int i = a; cond; ++i)
#define revc(i,a,cond) for(int i = a; cond; --i)

#define all(x) (x.begin(),x.end())
#define rall(x) (x.rbegin(),x.rend())

#define pb push_back
#define eb pb
//emplace_back
#define mp make_pair

int INF = 1e9;
int const N = 2e5 + 16;
int const M = 1e9 + 7;

template < class t > void sc(t & x) {
  x = 0;
  int c = 0, z = 0, sign = 1;
  while (!isdigit(c = getchar()))
    z = c;
  if (z == '-')
    sign = -1;
  x = c - '0';
  while (isdigit(c = getchar()))
    x = (x << 1) + (x << 3) + c - '0';
  x *= sign;
}

template < class t > void put(t x) {
  static char buf[32] = { };
  if (x == 0) {
    putchar('0');
    return;
  }
  int i = 32;
  if (x < 0)
    putchar('-'), x = -x;
  do
    buf[--i] = x % 10 + '0';
  while (x /= 10);
  while (i < 32)
    putchar(buf[i++]);
}

int n;
int logn;
ll tree[N+N];
ll z[N+N];
int cnt[N+N];

void build() {
  logn = 18;
  rep(i,0,N)
    cnt[i+N] = 1;
  revn(i,N-1,0)
    cnt[i] = cnt[i<<1]+cnt[i<<1|1];
}

void apply(int i, ll v) {
  tree[i] += v;
  if(i < n)
    z[i] += v;
}

void up(int i) {
  while(i>>=1)
    tree[i] = tree[i<<1]+tree[i<<1|1]+cnt[i]*z[i];
}

void push(int i) {
  for(int p = logn; p; --p) {
    int x = i >> p;
    if(z[x]) {
      apply(x<<1,z[x]);
      apply(x<<1|1,z[x]);
      z[x] = 0;
    }
  }
}

void update(int l, int r, ll v) {
  push(l += N);
  push(r += N);
  int lx = l, rx = r;
  ll sum = 0;
  for(;l <= r; l >>= 1, r >>= 1) {
    if(l&1)
      apply(l++, v);
    if((r&1)==0)
      apply(r--, v);
  }
  up(lx);
  up(rx);
}

ll query(int l, int r) {
  push(l += N);
  push(r += N);
  ll sum = 0;
  for(;l <= r; l >>= 1, r >>= 1) {
    if(l&1)
      sum += tree[l++];
    if((r&1)==0)
      sum += tree[r--];
  }
  return sum;
}

int main() {
  scanf("%d",&n);
  int len = 1;
  ll sum = 0;
  while(n--) {
    int t; scanf("%d",&t);
    if(t == 1) {
      int x, y; scanf("%d%d",&x,&y);
      update(1,x,y);
    } else if(t == 2) {
      int x; scanf("%d",&x);
      ++len;
      update(len,len,x);
    } else {
      --len;
    }

    printf("%.10f\n", (double)query(0,len)/len);
  }
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 100;

long long sum;
int m = 1;
long long v[N], w[N], T[N], ad;

int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    int t, a, b;
    scanf("%d", &t);
    if (t == 3) {
      if (m) sum -= v[--m] + w[m];
      if (m) w[m - 1] += w[m];
    } else if (t == 1) {
      scanf("%d %d", &a, &b);
      a = min(a, m);
      w[a - 1] += b;
      sum += 1ll * a * b;
    } else {
      scanf("%d", &a);
      sum += a; v[m++] = a;
    }
    double ans = m ? 1.0 * sum / m : 0;
    printf("%.10f\n", ans);
  }
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 100;

long long sum;
int m = 1;
long long v[N], w[N], T[N];

int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    int t, a;
    long long b;
    scanf("%d", &t);
    if (t == 3) {
      w[m - 1] += w[m];
      if (m) sum -= v[m] + w[m--];
    } else if (t == 1) {
      scanf("%d %I64d", &a, &b);
      w[a] += b;
      sum += 1ll * a * b;
    } else {
      scanf("%d", &a);
      sum += a; v[++m] = a;
    }
    double ans = m ? sum / (double) m : 0;
    printf("%.6f\n", ans);
  }
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 100;

long long sum;
int m = 1;
long long v[N], T[N], ad;

int lowbit(int x) {
  return x & -x;
}

void add(int i, int x) {
  for (; i < N; i += lowbit(i))
    T[i] += x;
}

long long get(int i) {
  long long ans = 0;
  for (; i; i -= lowbit(i))
    ans += T[i];
  return ans;
}

int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    int t, a, b;
    scanf("%d", &t);
    if (t == 3) {
      if (m) sum -= v[--m] + ad + get(m);
    } else if (t == 1) {
      scanf("%d %d", &a, &b);
      a = min(a, m);
      add(a, -b);
      ad += b;
      sum += 1ll * a * b;
    } else {
      scanf("%d", &a);
      sum += a; v[m++] = a;
    }
    printf("%.10f\n", m ? (long double) sum / m : 0);
  }
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 100;

long long sum;
int m = 1;
long long v[N], w[N], T[N];

int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    int t, a, b;
    scanf("%d", &t);
    if (t == 3) {
      w[m - 1] += w[m];
      sum -= v[m] + w[m--];
    } else if (t == 1) {
      scanf("%d %d", &a, &b);
      w[a] += b;
      sum += 1ll * a * b;
    } else {
      scanf("%d", &a);
      sum += a; v[++m] = a;
    }
    double ans = m ? sum / (double) m : 0;
    printf("%.6f\n", ans);
  }
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 100;

long long sum;
int m = 1;
long long v[N], w[N], T[N];

int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    int t, a;
    long long b;
    scanf("%d", &t);
    if (t == 3) {
      if (m) sum -= v[m] + w[m--];
      w[m - 1] += w[m];
    } else if (t == 1) {
      scanf("%d %I64d", &a, &b);
      w[a] += b;
      sum += 1ll * a * b;
    } else {
      scanf("%d", &a);
      sum += a; v[++m] = a;
    }
    double ans = m ? 1.0 * sum / m : 0;
    printf("%.6f\n", ans);
  }
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 100;

long long sum;
int m = 1;
long long v[N], w[N], T[N];

int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    int t, a;
    long long b;
    scanf("%d", &t);
    if (t == 3) {
      w[m - 1] += w[m];
      if (m) sum -= v[m] + w[m--];
    } else if (t == 1) {
      scanf("%d %I64d", &a, &b);
      w[a] += b;
      sum += 1ll * a * b;
    } else {
      scanf("%d", &a);
      sum += a; v[++m] = a;
    }
    double ans = m ? 1.0 * sum / m : 0;
    printf("%.6f\n", ans);
  }
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 100;

long long sum;
int m = 1;
long long v[N], T[N], ad;

int lowbit(int x) {
  return x & -x;
}

void add(int i, int x) {
  for (; i < N; i += lowbit(i))
    T[i] += x;
}

long long get(int i) {
  long long ans = 0;
  for (; i; i -= lowbit(i))
    ans += T[i];
  return ans;
}

int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    int t, a, b;
    scanf("%d", &t);
    if (t == 3) {
      if (m) sum -= v[--m] + ad + get(m);
    } else if (t == 1) {
      scanf("%d %d", &a, &b);
      a = min(a, m);
      add(a, -b);
      ad += b;
      sum += 1ll * a * b;
    } else {
      scanf("%d", &a);
      sum += a; v[m++] = a;
    }
    long double ans = m ? 1.0 * sum / m : 0
    printf("%.10lf\n", ans);
  }
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 100;

long long sum;
int m = 1;
long long v[N], w[N], T[N];

int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    int t, a, b;
    scanf("%d", &t);
    if (t == 3) {
      if (m > 1)
        w[m - 1] += w[m], sum -= v[m] + w[m--];
    } else if (t == 1) {
      scanf("%d %d", &a, &b);
      w[a] += b;
      sum += 1ll * a * b;
    } else {
      scanf("%d", &a);
      sum += a; v[++m] = a; w[m] = 0;
    }
    double ans = m ? sum / (double) m : 0;
    printf("%.6f\n", ans);
  }
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 100;

long double sum, ad, v[N], T[N];
int m = 1;

int lowbit(int x) {
  return x & -x;
}

void add(int i, int x) {
  for (; i < N; i += lowbit(i))
    T[i] += x;
}

long long get(int i) {
  long long ans = 0;
  for (; i; i -= lowbit(i))
    ans += T[i];
  return ans;
}

int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    int t, a, b;
    scanf("%d", &t);
    if (t == 3) {
      if (m) sum -= v[--m] + ad + get(m);
    } else if (t == 1) {
      scanf("%d %d", &a, &b);
      a = min(a, m);
      add(a, -b);
      ad += b;
      sum += 1ll * a * b;
    } else {
      scanf("%d", &a);
      sum += a; v[m++] = a;
    }
    printf("%.10f\n", m ? sum / m : 0);
  }
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 100;

long long sum;
int m = 1;
long long v[N], w[N], T[N], ad;

int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    int t, a, b;
    scanf("%d", &t);
    if (t == 3) {
      if (m) sum -= v[--m] + w[m];
      if (m) w[m - 1] += w[m];
    } else if (t == 1) {
      scanf("%d %d", &a, &b);
      a = min(a, m);
      w[a] += b;
      sum += 1ll * a * b;
    } else {
      scanf("%d", &a);
      sum += a; v[m++] = a;
    }
    double ans = m ? 1.0 * sum / m : 0;
    printf("%.10f\n", ans);
  }
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 100;

long long sum;
int m = 1;
long long v[N], T[N], ad;

int lowbit(int x) {
  return x & -x;
}

void add(int i, int x) {
  for (; i < N; i += lowbit(i))
    T[i] += x;
}

long long get(int i) {
  long long ans = 0;
  for (; i; i -= lowbit(i))
    ans += T[i];
  return ans;
}

int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    int t, a, b;
    scanf("%d", &t);
    if (t == 3) {
      if (m) sum -= v[--m] + ad + get(m);
    } else if (t == 1) {
      scanf("%d %d", &a, &b);
      a = min(a, m);
      add(a, -b);
      ad += b;
      sum += 1ll * a * b;
    } else {
      scanf("%d", &a);
      sum += a; v[m++] = a;
    }
    long double ans = m ? 1.0 * sum / m : 0;
    printf("%.10lf\n", ans);
  }
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 100;

long long sum;
int m = 1;
long long v[N], w[N], T[N];

int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    int t, a, b;
    scanf("%d", &t);
    if (t == 3) {
      if (m > 1)
        w[m - 1] += w[m], sum -= v[m] + w[m--];
    } else if (t == 1) {
      scanf("%d %d", &a, &b);
      w[a] += b;
      sum += 1ll * a * b;
    } else {
      scanf("%d", &a);
      sum += a; v[++m] = a; w[m] = 0;
    }
    double ans = m ? 1.0 * sum / m : 0;
    printf("%.6f\n", ans);
  }
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 100;

long long sum;
int m = 1;
long long v[N], w[N], T[N];

int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    int t, a;
    long long b;
    scanf("%d", &t);
    if (t == 3) {
      if (m) sum -= v[m] + w[m--];
      w[m - 1] += w[m];
    } else if (t == 1) {
      scanf("%d %I64d", &a, &b);
      w[a] += b;
      sum += 1ll * a * b;
    } else {
      scanf("%d", &a);
      sum += a; v[++m] = a;
    }
    double ans = m ? 1.0 * sum / m : 0;
    printf("%.10f\n", ans);
  }
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 100;

long long sum;
int m = 1;
long long v[N], w[N], T[N], ad;

int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    int t, a, b;
    scanf("%d", &t);
    if (t == 3) {
      if (m) sum -= v[--m] + w[m];
      if (m) w[m - 1] += w[m];
    } else if (t == 1) {
      scanf("%d %d", &a, &b);
      w[a - 1] += b;
      sum += 1ll * a * b;
    } else {
      scanf("%d", &a);
      sum += a; v[m++] = a;
    }
    double ans = m ? 1.0 * sum / m : 0;
    printf("%.10f\n", ans);
  }
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 100;

long long sum;
int m = 1;
long long v[N], T[N], ad;

int lowbit(int x) {
  return x & -x;
}

void add(int i, int x) {
  for (; i < N; i += lowbit(i))
    T[i] += x;
}

long long get(int i) {
  long long ans = 0;
  for (; i; i -= lowbit(i))
    ans += T[i];
  return ans;
}

int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    int t, a, b;
    scanf("%d", &t);
    if (t == 3) {
      if (m) sum -= v[--m] + ad + get(m);
    } else if (t == 1) {
      scanf("%d %d", &a, &b);
      a = min(a, m);
      add(a, -b);
      ad += b;
      sum += 1ll * a * b;
    } else {
      scanf("%d", &a);
      sum += a; v[m++] = a;
    }
    printf("%.10f\n", m ? (double) sum / m : 0);
  }
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 100;

long long sum;
int m = 1;
long long v[N], w[N], T[N];

int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    int t, a, b;
    scanf("%d", &t);
    if (t == 3) {
      w[m - 1] += w[m];
      if (m > 1) sum -= v[m] + w[m--];
    } else if (t == 1) {
      scanf("%d %d", &a, &b);
      w[a] += b;
      sum += 1ll * a * b;
    } else {
      scanf("%d", &a);
      sum += a; v[++m] = a;
    }
    double ans = m ? sum / (double) m : 0;
    printf("%.6f\n", ans);
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define trace(x) cerr << #x << ": " << x << " ";
#define trnl cerr << "\n";
typedef long long lolo;
typedef unsigned long long ulolo;
typedef pair<int, int> pii;
#define R(i,n) for(int i=0;i<(n);++i)
#define F(i,a,b) for(int i=(a);i<(b);++i)
#define FS(i,a,b,s) for(int i=(a);i<(b);i+=(s))
#define FD(i,n) for(int i=(n-1);i>=0;--i)
#define FDS(i,n,s) for(int i=(n-1);i>=0;i-=(s))
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define fi first
#define se second
#define M_PI           3.14159265358979323846

const int INF = 1e9 + 23;
const int MOD = 1e9 + 7;
const int N = 2e5 + 100;

int arr[N];

int main()
{
	ios_base::sync_with_stdio(0);
	int n, t, lst = 1;
	lolo sum = 0;
	stringstream ss;
	ss.precision(numeric_limits<double>::max_digits10);
	ss << fixed;
	cin >> n;
	while (n--) {
		cin >> t;
		if (t == 1) {
			int a, x;
			cin >> a >> x;
			arr[0] += x;
			arr[a] -= x;
			sum += a * x;
		}
		else if (t == 2) {
			int k;
			cin >> k;
			arr[lst] += k;
			++lst;
			arr[lst] -= k;
			sum += k;
		}
		else {
			sum += arr[lst];
			arr[lst - 1] += arr[lst];
			arr[lst] = 0;
			--lst;
		}
		double avg = sum * 1.0 / lst;
		ss << avg << "\n";
	}
	cout << ss.str() << "\n";
	return 0;
}
// g++ -W -Wall -Wextra -pedantic -std=c++0x -o p main.cpp


#include <bits/stdc++.h>

using namespace std;

#define trace(x) cerr << #x << ": " << x << " ";
#define tracen(x) cerr << #x << ": " << x << "\n";

typedef long long lolo;
typedef unsigned long long ulolo;
typedef pair<int, int> point;
#define fi first
#define se second

const int INF = 1e9 + 23;
const int MOD = 1e9 + 7;
const int MAXN = 2 * 1e5 + 100;

int arr[MAXN];

int main()
{
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  stringstream ss;
  ss << setprecision(numeric_limits<double>::max_digits10);
  ss << fixed;
  int n, t, x, a, last = 1; lolo sum = 0;
  cin >> n;
  while (n--) {
    cin >> t;
    if (t == 1) {
      cin >> a >> x;
      sum += a * x;
      arr[a] += x;
    } else if (t == 2) {
      cin >> x;
      arr[last] -= x;
      arr[last + 1] += x;
      sum += x;
      ++last;
    } else {
      sum -= arr[last];
      arr[last - 1] += arr[last];
      arr[last] = 0;
      --last;
    }
    ss << sum * 1.0 / last << "\n";
  }
  cout << ss.str();
  return 0;
}

// g++ -W -Wall -Wextra -pedantic -std=c++0x -o p main.cpp


#include <bits/stdc++.h>
using namespace std;

#define trace(x) cerr << #x << ": " << x << " ";
#define trnl cerr << "\n";
typedef long long lolo;
typedef unsigned long long ulolo;
typedef pair<int, int> pii;
#define R(i,n) for(int i=0;i<(n);++i)
#define F(i,a,b) for(int i=(a);i<(b);++i)
#define FS(i,a,b,s) for(int i=(a);i<(b);i+=(s))
#define FD(i,n) for(int i=(n-1);i>=0;--i)
#define FDS(i,n,s) for(int i=(n-1);i>=0;i-=(s))
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define fi first
#define se second
#define M_PI           3.14159265358979323846

const int INF = 1e9 + 23;
const int MOD = 1e9 + 7;
const int N = 2e5 + 100;

int arr[N];

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	int n, t, lst = 1;
	lolo sum = 0;
	stringstream ss;
	ss.precision(numeric_limits<double>::max_digits10);
	ss << fixed;
	cin >> n;
	while (n--) {
		cin >> t;
		if (t == 1) {
			int a, x;
			cin >> a >> x;
			arr[0] += x;
			arr[a] -= x;
			sum += a * x;
		}
		else if (t == 2) {
			int k;
			cin >> k;
			arr[lst] += k;
			++lst;
			arr[lst] -= k;
			sum += k;
		}
		else {
			sum += arr[lst];
			arr[lst - 1] += arr[lst];
			arr[lst] = 0;
			--lst;
		}
		double avg = sum * 1.0 / lst;
		ss << avg << "\n";
	}
	cout << ss.str() << "\n";
	return 0;
}
// g++ -W -Wall -Wextra -pedantic -std=c++0x -o p main.cpp


#include <bits/stdc++.h>

using namespace std;

#define trace(x) cerr << #x << ": " << x << " ";
#define tracen(x) cerr << #x << ": " << x << "\n";

typedef long long lolo;
typedef unsigned long long ulolo;
typedef pair<int, int> point;
#define fi first
#define se second

const int INF = 1e9 + 23;
const int MOD = 1e9 + 7;
const int MAXN = 2 * 1e5;
const int RANGE = 1 << (32 - __builtin_clz((unsigned int)(MAXN)));

int tr[(RANGE << 1) + 100];

void add(int i, int pleft, int pright, int left, int right, int val) {
  if (right < pleft || pright < left) return;
  //trace(i); trace(pleft); trace(pright); trace(left); tracen(right);
  if (left <= pleft && pright <= right) {
    tr[i] += val;
    return;
  }
  int br = (pleft + pright) / 2;
  add(i << 1, pleft, br, left, right, val);
  ++br;
  add((i << 1) + 1, br, pright, left, right, val);
}

int get(int i) {
  int s = 0;
  int pos = RANGE - 1 + i;
  while (pos > 0) {
    s += tr[pos];
    //trace(pos); tracen(tr[pos]);
    pos /= 2;
  }
  return s;
}

int main()
{
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  stringstream ss;
  ss << setprecision(numeric_limits<double>::max_digits10);
  ss << fixed;
  //tracen(RANGE);
  int n, t, x, a, last = 1; lolo sum = 0;
  cin >> n;
  while (n--) {
    cin >> t;
    if (t == 1) {
      cin >> a >> x;
      add(1, 1, RANGE, 1, a, x);
      sum += a * x;
    } else if (t == 2) {
      cin >> x;
      sum += x;
      ++last;
      add(1, 1, RANGE, last, last, x);
    } else {
      int val = get(last);
      //tracen(val);
      add(1, 1, RANGE, last, last, -val);
      sum -= val;
      --last;
    }
    //trace(sum); tracen(last);
    ss << sum * 1.0 / last << "\n";
  }
  cout << ss.str();
  return 0;
}

// g++ -W -Wall -Wextra -pedantic -std=c++0x -o p main.cpp


#include <bits/stdc++.h>

using namespace std;

#define trace(x) cerr << #x << ": " << x << " ";
#define tracen(x) cerr << #x << ": " << x << "\n";

typedef long long lolo;
typedef unsigned long long ulolo;
typedef pair<int, int> point;
#define fi first
#define se second

const int INF = 1e9 + 23;
const int MOD = 1e9 + 7;
const int MAXN = 2 * 1e5;
const int RANGE = 1 << (32 - __builtin_clz((unsigned int)(MAXN)));

int tr[(RANGE << 1) + 100];

void add(int i, int pleft, int pright, int left, int right, int val) {
  if (right < pleft || pright < left) return;
  //trace(i); trace(pleft); trace(pright); trace(left); tracen(right);
  if (left <= pleft && pright <= right) {
    tr[i] += val;
    return;
  }
  int br = (pleft + pright) / 2;
  add(i << 1, pleft, br, left, right, val);
  ++br;
  add((i << 1) + 1, br, pright, left, right, val);
}

int get(int i) {
  int s = 0;
  int pos = RANGE - 1 + i;
  while (pos > 0) {
    s += tr[pos];
    //trace(pos); tracen(tr[pos]);
    pos /= 2;
  }
  return s;
}

int main()
{
  std::ios::sync_with_stdio(false);
  cout << setprecision(numeric_limits<double>::max_digits10);
  cout << fixed;
  //tracen(RANGE);
  int n, t, x, a, last = 1; lolo sum = 0;
  cin >> n;
  while (n--) {
    cin >> t;
    if (t == 1) {
      cin >> a >> x;
      add(1, 1, RANGE, 1, a, x);
      sum += a * x;
    } else if (t == 2) {
      cin >> x;
      sum += x;
      ++last;
      add(1, 1, RANGE, last, last, x);
    } else {
      int val = get(last);
      //tracen(val);
      add(1, 1, RANGE, last, last, -val);
      sum -= val;
      --last;
    }
    //trace(sum); tracen(last);
    cout << sum * 1.0 / last << "\n";
  }
  return 0;
}

// g++ -W -Wall -Wextra -pedantic -std=c++0x -o p main.cpp


#include <bits/stdc++.h>
using namespace std;

#define trace(x) cerr << #x << ": " << x << " ";
#define trnl cerr << "\n";
typedef long long lolo;
typedef unsigned long long ulolo;
typedef pair<int, int> pii;
#define R(i,n) for(int i=0;i<(n);++i)
#define F(i,a,b) for(int i=(a);i<(b);++i)
#define FS(i,a,b,s) for(int i=(a);i<(b);i+=(s))
#define FD(i,n) for(int i=(n-1);i>=0;--i)
#define FDS(i,n,s) for(int i=(n-1);i>=0;i-=(s))
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define fi first
#define se second
#define M_PI           3.14159265358979323846

const int INF = 1e9 + 23;
const int MOD = 1e9 + 7;
const int N = 2e5 + 100;

int arr[N];

int main()
{
	ios_base::sync_with_stdio(0);
	int n, t, lst = 1;
	lolo sum = 0;
	cout.precision(numeric_limits<double>::max_digits10);
	cin >> n;
	while (n--) {
		cin >> t;
		if (t == 1) {
			int a, x;
			cin >> a >> x;
			arr[0] += x;
			arr[a] -= x;
			sum += a * x;
		}
		else if (t == 2) {
			int k;
			cin >> k;
			arr[lst] += k;
			++lst;
			arr[lst] -= k;
			sum += k;
		}
		else {
			sum += arr[lst];
			arr[lst - 1] += arr[lst];
			arr[lst] = 0;
			--lst;
		}
		double avg = sum * 1.0 / lst;
		cout << fixed << avg << "\n";
	}
	return 0;
}
// g++ -W -Wall -Wextra -pedantic -std=c++0x -o p main.cpp


#include <bits/stdc++.h>
using namespace std;

#define trace(x) cerr << #x << ": " << x << " ";
#define trnl cerr << "\n";
typedef long long lolo;
typedef unsigned long long ulolo;
typedef pair<int, int> pii;
#define R(i,n) for(int i=0;i<(n);++i)
#define F(i,a,b) for(int i=(a);i<(b);++i)
#define FS(i,a,b,s) for(int i=(a);i<(b);i+=(s))
#define FD(i,n) for(int i=(n-1);i>=0;--i)
#define FDS(i,n,s) for(int i=(n-1);i>=0;i-=(s))
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define fi first
#define se second
#define M_PI           3.14159265358979323846

const int INF = 1e9 + 23;
const int MOD = 1e9 + 7;
const int N = 5e3 + 100;

int arr[N];

int main()
{
	ios_base::sync_with_stdio(0);
	int n, t, lst = 1;
	lolo sum = 0;
	cout.precision(numeric_limits<double>::max_digits10);
	cin >> n;
	while (n--) {
		cin >> t;
		if (t == 1) {
			int a, x;
			cin >> a >> x;
			arr[0] += x;
			arr[a] -= x;
			sum += a * x;
		}
		else if (t == 2) {
			int k;
			cin >> k;
			arr[lst] += k;
			++lst;
			arr[lst] -= k;
			sum += k;
		}
		else {
			sum += arr[lst];
			arr[lst - 1] += arr[lst];
			arr[lst] = 0;
			--lst;
		}
		double avg = sum * 1.0 / lst;
		cout << fixed << avg << "\n";
	}
	return 0;
}
// g++ -W -Wall -Wextra -pedantic -std=c++0x -o p main.cpp


#include <bits/stdc++.h>

using namespace std;

#define trace(x) cerr << #x << ": " << x << " ";
#define tracen(x) cerr << #x << ": " << x << "\n";

typedef long long lolo;
typedef unsigned long long ulolo;
typedef pair<int, int> point;
#define fi first
#define se second

const int INF = 1e9 + 23;
const int MOD = 1e9 + 7;
const int MAXN = 2 * 1e5 + 100;

int arr[MAXN];

int main()
{
  std::ios::sync_with_stdio(false);
  stringstream ss;
  ss << setprecision(numeric_limits<double>::max_digits10);
  ss << fixed;
  int n, t, x, a, last = 1; lolo sum = 0;
  cin >> n;
  while (n--) {
    cin >> t;
    if (t == 1) {
      cin >> a >> x;
      sum += a * x;
      arr[a] += x;
    } else if (t == 2) {
      cin >> x;
      arr[last] -= x;
      arr[last + 1] += x;
      sum += x;
      ++last;
    } else {
      sum -= arr[last];
      arr[last - 1] += arr[last];
      arr[last] = 0;
      --last;
    }
    ss << sum * 1.0 / last << "\n";
  }
  cout << ss.str();
  return 0;
}

// g++ -W -Wall -Wextra -pedantic -std=c++0x -o p main.cpp


#include <bits/stdc++.h>
using namespace std;

#define trace(x) cerr << #x << ": " << x << " ";
#define trnl cerr << "\n";
typedef long long lolo;
typedef unsigned long long ulolo;
typedef pair<int, int> pii;
#define R(i,n) for(int i=0;i<(n);++i)
#define F(i,a,b) for(int i=(a);i<(b);++i)
#define FS(i,a,b,s) for(int i=(a);i<(b);i+=(s))
#define FD(i,n) for(int i=(n-1);i>=0;--i)
#define FDS(i,n,s) for(int i=(n-1);i>=0;i-=(s))
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define fi first
#define se second
#define M_PI           3.14159265358979323846

const int INF = 1e9 + 23;
const int MOD = 1e9 + 7;
const int N = 2e5 + 100;

int arr[N];

int main()
{
	ios_base::sync_with_stdio(0);
	int n, t, lst = 1;
	lolo sum = 0;
	cout.precision(numeric_limits<double>::max_digits10);
	cout << fixed;
	cin >> n;
	while (n--) {
		cin >> t;
		if (t == 1) {
			int a, x;
			cin >> a >> x;
			arr[0] += x;
			arr[a] -= x;
			sum += a * x;
		}
		else if (t == 2) {
			int k;
			cin >> k;
			arr[lst] += k;
			++lst;
			arr[lst] -= k;
			sum += k;
		}
		else {
			sum += arr[lst];
			arr[lst - 1] += arr[lst];
			arr[lst] = 0;
			--lst;
		}
		double avg = sum * 1.0 / lst;
		cout << avg << "\n";
	}
	return 0;
}
// g++ -W -Wall -Wextra -pedantic -std=c++0x -o p main.cpp


#include <bits/stdc++.h>

using namespace std;

#define trace(x) cerr << #x << ": " << x << " ";
#define tracen(x) cerr << #x << ": " << x << "\n";

typedef long long lolo;
typedef unsigned long long ulolo;
typedef pair<int, int> point;
#define fi first
#define se second

const int INF = 1e9 + 23;
const int MOD = 1e9 + 7;
const int MAXN = 2 * 1e5;
const int RANGE = 1 << (32 - __builtin_clz((unsigned int)(MAXN)));

int tr[(RANGE << 1) + 100];

void add(int i, int pleft, int pright, int left, int right, int val) {
  if (right < pleft || pright < left) return;
  //trace(i); trace(pleft); trace(pright); trace(left); tracen(right);
  if (left <= pleft && pright <= right) {
    tr[i] += val;
    return;
  }
  int br = (pleft + pright) / 2;
  add(i << 1, pleft, br, left, right, val);
  ++br;
  add((i << 1) + 1, br, pright, left, right, val);
}

int get(int i) {
  int s = 0;
  int pos = RANGE - 1 + i;
  while (pos > 0) {
    s += tr[pos];
    //trace(pos); tracen(tr[pos]);
    pos /= 2;
  }
  return s;
}

int main()
{
  std::ios::sync_with_stdio(false);
  stringstream ss;
  ss << setprecision(numeric_limits<double>::max_digits10);
  ss << fixed;
  //tracen(RANGE);
  int n, t, x, a, last = 1; lolo sum = 0;
  cin >> n;
  while (n--) {
    cin >> t;
    if (t == 1) {
      cin >> a >> x;
      add(1, 1, RANGE, 1, a, x);
      sum += a * x;
    } else if (t == 2) {
      cin >> x;
      sum += x;
      ++last;
      add(1, 1, RANGE, last, last, x);
    } else {
      int val = get(last);
      //tracen(val);
      add(1, 1, RANGE, last, last, -val);
      sum -= val;
      --last;
    }
    //trace(sum); tracen(last);
    ss << sum * 1.0 / last << "\n";
  }
  cout << ss.str();
  return 0;
}

// g++ -W -Wall -Wextra -pedantic -std=c++0x -o p main.cpp


#include<bits/stdc++.h>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

    long long int  n,t,x,a,i,k,z;
    double sum=0;
    double avg;
    cin>>n;
    vector<long long int>v;
    v.push_back(0);
    while(n--)
    {
        cin>>t;
        if(t==1)
        {
            //cin>>a>>x;
            scanf("%I64d %I64d",&a,&x);
            for(i=0;i<a;i++)
            {
                v[i]=v[i]+x;
            }
        }
        else if(t==2)
        {
            cin>>k;
            v.push_back(k);
        }
        else if(t==3)
        {  if(v.size()>=2)
           {
            v.pop_back();
           }
        }
        else;
         sum=0;
         long long int k=v.size();
         for( i=0;i<k;i++)
         {
            sum=sum+v[i];
         }
         avg=sum/v.size();
        //   cout<<fixed<<setprecision(6)<<avg<<"\n";
         printf("%.7f\n",avg);
       //  cout<<fixed<<setprecision(6)<<avg<<"\n";
    }

    	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	int n,cnt=1,a,b,c;
	long long int sum=0;
	float ans;

	map<int,int> m;
	map<int,int>::iterator it;

	cin>>n;

	int arr[n+1];

	arr[0]=0;

	cout<<fixed;

	for(int i=0;i<n;i++)
	{
		cin>>a;

		if(a==2)
		{
			cin>>b;
			arr[cnt++]=b;
			sum+=b;

			ans=(float)sum/cnt;
			cout<<setprecision(6)<<ans<<"\n";

		}

		else if(a==1)
		{
			cin>>b>>c;

			if(m[b]==0)
			m[b]=c;
			else
			m[b]+=c;
			{
				for(it=m.begin();it->first<b;it++)
				it->second=it->second+c;

			}

			sum+=b*c;

			ans=(float)sum/cnt;
			cout<<setprecision(6)<<ans<<"\n";

		}

		else
		{
			int temp;
			cnt--;

			sum-=arr[cnt];

			for(it=m.begin();it!=m.end();it++)
				if(it->first>=cnt+1)
				{
					sum-=it->second;
					break;
				}

			ans=(float)sum/cnt;
			cout<<setprecision(6)<<ans<<"\n";

		}

	}

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	 ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

	int n,cnt=1,a,b,c,lindex=0;

	long long int sum=0,negative=0;

	double ans;

	cin>>n;
	int arr[200001]={0};
	int edit[200001]={0};
	cout<<fixed;

	for(int i=0;i<n;i++)
	{
		cin>>a;

		if(a==2)
		{
			cin>>b;
			arr[cnt++]=b;
			sum+=b;

			ans=(double)sum/cnt;
			printf("%.9lf\n",ans);
		}

		else if(a==1)
		{
			cin>>b>>c;

			if(b>lindex)
			{

				edit[lindex]+=negative;
				edit[b]=c;
				negative=0;
				sum+=b*c;
				lindex=b;
			}

			else
			{
				edit[b]+=c;
				sum+=b*c;

			}

			ans=(double)sum/cnt;
			printf("%.9lf\n",ans);
		}

		else
		{
			cnt--;
			sum-=arr[cnt];
			if(cnt<lindex)
			{
				if(edit[lindex]==0);

				else
				negative+=edit[lindex];

				sum-=negative;
				lindex--;

			}
			ans=(double)sum/cnt;
			printf("%.9lf\n",ans);

		}

	}

	return 0;

}


#include<bits/stdc++.h>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    long long int  n,t,x,a,i,k,z;
    double sum=0;
    double avg;
    cin>>n;
    vector<long long int>v;
    v.push_back(0);
    while(n--)
    {
        cin>>t;
        if(t==1)
        {
            cin>>a>>x;
            for(i=0;i<a;i++)
            {
                v[i]=v[i]+x;
            }
        }
        else if(t==2)
        {
            cin>>k;
            v.push_back(k);
        }
        else if(t==3)
        {  if(v.size()>=2)
           {
            v.pop_back();
           }
        }
        else;
         sum=0;
         for( i=0;i<v.size();i++)
         {
            sum=sum+v[i];
         }
         avg=sum/v.size();
         cout<<fixed<<setprecision(6)<<avg<<endl;
    }

    	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{

	 ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

	int n,cnt=1,a,b,c;
	long long int sum=0;
	float ans;

	map<int,int> m;
	map<int,int>::iterator it;

	cin>>n;

	int arr[n+1];

	arr[0]=0;

	cout<<fixed;

	for(int i=0;i<n;i++)
	{
		cin>>a;

		if(a==2)
		{
			cin>>b;
			arr[cnt++]=b;
			sum+=b;

			ans=(float)sum/cnt;
			cout<<setprecision(6)<<ans<<"\n";

		}

		else if(a==1)
		{
			cin>>b>>c;

			if(m[b]==0)
			m[b]=c;
			else
			m[b]+=c;

			sum+=b*c;

			ans=(float)sum/cnt;
			cout<<setprecision(6)<<ans<<"\n";

		}

		else
		{
			int temp;
			cnt--;

			sum-=arr[cnt];

			for(it=m.begin();it!=m.end();it++)
				if(it->first>=cnt+1)
				{
					sum-=it->second;
				}

			ans=(float)sum/cnt;
			cout<<setprecision(6)<<ans<<"\n";

		}

	}

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	 ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

	int n,cnt=1,a,b,c,lindex=0;

	long long int sum=0,negative=0;

	double ans;

	cin>>n;
	int arr[200001]={0};
	int edit[200001]={0};
	cout<<fixed;

	for(int i=0;i<n;i++)
	{
		cin>>a;

		if(a==2)
		{
			cin>>b;
			arr[cnt++]=b;
			sum+=b;

			ans=(double)sum/cnt;
			printf("%.9lf\n",ans);
		}

		else if(a==1)
		{
			cin>>b>>c;

			edit[b]+=c;
			sum+=b*c;

			if(b>lindex)
			{
				lindex=b;
				negative=0;
			}
			ans=(double)sum/cnt;
			printf("%.9lf\n",ans);
		}

		else
		{
			cnt--;
			sum-=arr[cnt];
			if(cnt<lindex)
			{
				if(edit[lindex]==0);

				else
				negative+=edit[lindex];

				sum-=negative;
				lindex--;

			}
			ans=(double)sum/cnt;
			printf("%.9lf\n",ans);

		}

	}

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	 ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

	int n,cnt=1,a,b,c,lindex=0;

	 double  sum=0,ans;

	scanf("%d",&n);

	int arr[200001]={0};
	int edit[200001]={0};

	for(int i=0;i<n;i++)
	{
		scanf("%d",&a);

		 if(a==1)
		{
			scanf("%d%d",&b,&c);
			edit[b]+=c;
			sum+=double(b)*c;

			if(b>lindex)
			lindex=b;

			ans=double(sum)/cnt;
			printf("%.6lf\n",ans);
		}
		else if(a==2)
		{
			scanf("%d",&b);
			arr[cnt++]=b;
			sum+=double(b);

			ans=double(sum)/cnt;
			printf("%.6lf\n",ans);
		}

		else
		{
			cnt--;
			sum-=double(arr[cnt]);
			if(cnt<lindex)
			{
				sum-=double(edit[lindex]);
				edit[lindex-1]+=edit[lindex];
				edit[lindex]=0;
				lindex--;
			}
			ans=double(sum)/cnt;
			printf("%.6lf\n",ans);
		}
	}
	return 0;
}


#include<bits/stdc++.h>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

    long long int  n,t,x,a,i,k,z;
    double sum=0;
    double avg;
    cin>>n;
    vector<long long int>v;
    v.push_back(0);
    while(n--)
    {
        cin>>t;
        if(t==1)
        {
            cin>>a>>x;
           // scanf("%I64d %I64d",&a,&x);
            for(i=0;i<a;i++)
            {
                v[i]=v[i]+x;
            }
        }
        else if(t==2)
        {
            cin>>k;
            v.push_back(k);
        }
        else if(t==3)
        {  if(v.size()>=2)
           {
            v.pop_back();
           }
        }
        else;
         sum=0;
         long long int k=v.size();
         for( i=0;i<k;i++)
         {
            sum=sum+v[i];
         }
         avg=sum/v.size();
        //   cout<<fixed<<setprecision(6)<<avg<<"\n";
         printf("%.7f\n",avg);
       //  cout<<fixed<<setprecision(6)<<avg<<"\n";
    }

    	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	 ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

	int n,cnt=1,a,b,c,lindex=0;

	long long int sum=0,negative=0;

	float ans;

	cin>>n;
	int arr[200001]={0};
	int edit[200001]={0};
	cout<<fixed;

	for(int i=0;i<n;i++)
	{
		cin>>a;

		if(a==2)
		{
			cin>>b;
			arr[cnt++]=b;
			sum+=b;

			ans=(float)sum/cnt;
			cout<<setprecision(6)<<ans<<"\n";
		}

		else if(a==1)
		{
			cin>>b>>c;

			edit[b]+=c;
			sum+=b*c;

			if(b>lindex)
			{
				lindex=b;
				negative=0;
			}
			ans=(float)sum/cnt;
			cout<<setprecision(6)<<ans<<"\n";
		}

		else
		{
			cnt--;
			sum-=arr[cnt];
			if(cnt<lindex)
			{
				if(edit[lindex]==0);

				else
				negative+=edit[lindex];

				sum-=negative;
				lindex--;

			}
			ans=(float)sum/cnt;
			cout<<setprecision(6)<<ans<<"\n";

		}

	}

	return 0;

}


#include<bits/stdc++.h>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    long long int  n,t,x,a,i,k,z;
    double sum=0;
    double avg;
    cin>>n;
    vector<long long int>v;
    v.push_back(0);
    while(n--)
    {
        cin>>t;
        if(t==1)
        {
            cin>>a>>x;
            for(i=0;i<a;i++)
            {
                v[i]=v[i]+x;
            }
        }
        else if(t==2)
        {
            cin>>k;
            v.push_back(k);
        }
        else if(t==3)
        {  if(v.size()>=2)
           {
            v.pop_back();
           }
        }
        else;
         sum=0;
         for( i=0;i<v.size();i++)
         {
            sum=sum+v[i];
         }
         avg=sum/v.size();
         cout<<fixed<<setprecision(6)<<avg<<"\n";
    }

    	return 0;
}


/*One Ring to rule them all, One Ring to find them,
  One Ring to bring them all, and in the darkness bind them*/
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <list>
#include <deque>
#include <bitset>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <sstream>
#include <complex>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <climits>
#include <utility>
#include <ctime>
#include <tuple>
#include <fstream>
#include <cctype>
#define FOR(i,a,n) for(i=a;i<n;i++)
#define FORD(i,a,n) for(i=a;i>=n;i--)
#define FORS(i,a) for(i=0;a[i];i++)
#define si(x) scanf("%d",&x)
#define sc(x) cin>>x
#define sd(x) scanf("%lf",&x)
#define sll(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define prs(x) printf("%d ",x)
#define pls(x) printf("%lld ",(long long)x)
#define pc(x) printf("%c",(char)x)
#define pi(x) printf("%d\n",x)
#define pd(x) printf("%.10lf\n",x);
#define pll(x) printf("%lld\n",(long long)x)
#define ps(x) printf("%s\n",x)
#define M 1000000007
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define pb push_back
#define fr first
#define se second
#define in insert
#define er erase
#define pii pair<int, int>
#define plll pair<long long, long long>
#define tr(x,it) for(auto it : x)
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230
#define bs(status,lo,hi,mid) {cerr<<#status<<"="<<status<<" "<<#lo<<"="<<lo<<" "<<#hi<<"="<<hi<<" "<<#mid<<"="<<mid<<endl;}
#define trace(x) {cerr << #x << "=" << x <<endl;}
#define trace2(x, y) {cerr << #x << "=" << x << " " << #y << "=" << y <<endl;}
using namespace std;
template <typename T> ostream& operator<<(ostream& os, const vector<T> &p){os << "[ "; for (T x: p) os << x << " "; os << "]" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const set<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const map<Tk, Tv> &p){os << "{ "; for (pair<Tk, Tv> x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const pair<Tk, Tv> &p){os << "{" << p.first << ',' << p.second << "}";return os;}
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n&1) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n&1) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

const int N=200005;
int a[2*N],b[2*N];

int main()
{
   int i,j;
   int sz=1;
   long double sum=0;
   int n;
   si(n);
   while(n--)
   {
   	int t;
   	si(t);
   	if(t==1)
   	{
   		long double no,x;
   		scanf("%Lf%Lf",&no,&x);
   		b[(int)no]+=x;
   		sum=(sum+x*no);
   	}
   	else if(t==2)
   	{
   		long double k;
   		scanf("%Lf",&k);
   		sum=(sum+k);
   		a[sz]=(int)k;
   		sz++;
   	}
   	else
   	{
   		sum=(sum-a[sz-1]-b[sz]);
   		sz--;
   		b[sz]+=b[sz+1];
   		b[sz+1]=0;
   	}
   	printf("%0.9Lf\n",sum/sz);
   }
   return 0;
}


/*One Ring to rule them all, One Ring to find them,
  One Ring to bring them all, and in the darkness bind them*/
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <list>
#include <deque>
#include <bitset>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <sstream>
#include <complex>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <climits>
#include <utility>
#include <ctime>
#include <tuple>
#include <fstream>
#include <cctype>
#define FOR(i,a,n) for(i=a;i<n;i++)
#define FORD(i,a,n) for(i=a;i>=n;i--)
#define FORS(i,a) for(i=0;a[i];i++)
#define si(x) scanf("%d",&x)
#define sc(x) cin>>x
#define sd(x) scanf("%lf",&x)
#define sll(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define prs(x) printf("%d ",x)
#define pls(x) printf("%lld ",(long long)x)
#define pc(x) printf("%c",(char)x)
#define pi(x) printf("%d\n",x)
#define pd(x)
#define pll(x) printf("%lld\n",(long long)x)
#define ps(x) printf("%s\n",x)
#define M 1000000007
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define pb push_back
#define fr first
#define se second
#define in insert
#define er erase
#define pii pair<int, int>
#define plll pair<long long, long long>
#define tr(x,it) for(auto it : x)
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230
#define bs(status,lo,hi,mid) {cerr<<#status<<"="<<status<<" "<<#lo<<"="<<lo<<" "<<#hi<<"="<<hi<<" "<<#mid<<"="<<mid<<endl;}
#define trace(x) {cerr << #x << "=" << x <<endl;}
#define trace2(x, y) {cerr << #x << "=" << x << " " << #y << "=" << y <<endl;}
using namespace std;
template <typename T> ostream& operator<<(ostream& os, const vector<T> &p){os << "[ "; for (T x: p) os << x << " "; os << "]" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const set<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const map<Tk, Tv> &p){os << "{ "; for (pair<Tk, Tv> x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const pair<Tk, Tv> &p){os << "{" << p.first << ',' << p.second << "}";return os;}
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n&1) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n&1) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

const int N=200005;
int a[2*N],b[2*N];

int main()
{
   int i,j;
   int sz=1;
   double avg=0;
   int n;
   si(n);
   cout.precision(10);
   while(n--)
   {
   	int t;
   	si(t);
   	if(t==1)
   	{
   		double no,x;
   		sd(no),sd(x);
   		b[(int)no]+=x;
   		avg=(avg*sz+x*no)/sz;
   	}
   	else if(t==2)
   	{
   		double k;
   		sd(k);
   		avg=(avg*sz+k)/(sz+1);
   		a[sz]=(int)k;
   		sz++;
   	}
   	else
   	{
   		avg=(avg*sz-a[sz-1]-b[sz])/(sz-1);
   		sz--;
   		b[sz]+=b[sz+1];
   	}
   	// trace(sz);
   	// FOR(i,0,sz)
   	// 	prs(a[i]);
   	// puts("");
   	cout<<fixed<<avg<<"\n";
   }
   return 0;
}


/*One Ring to rule them all, One Ring to find them,
  One Ring to bring them all, and in the darkness bind them*/
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <list>
#include <deque>
#include <bitset>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <sstream>
#include <complex>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <climits>
#include <utility>
#include <ctime>
#include <tuple>
#include <fstream>
#include <cctype>
#define FOR(i,a,n) for(i=a;i<n;i++)
#define FORD(i,a,n) for(i=a;i>=n;i--)
#define FORS(i,a) for(i=0;a[i];i++)
#define si(x) scanf("%d",&x)
#define sc(x) cin>>x
#define sd(x) scanf("%lf",&x)
#define sll(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define prs(x) printf("%d ",x)
#define pls(x) printf("%lld ",(long long)x)
#define pc(x) printf("%c",(char)x)
#define pi(x) printf("%d\n",x)
#define pd(x) printf("%.9lf\n",x);
#define pll(x) printf("%lld\n",(long long)x)
#define ps(x) printf("%s\n",x)
#define M 1000000007
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define pb push_back
#define fr first
#define se second
#define in insert
#define er erase
#define pii pair<int, int>
#define plll pair<long long, long long>
#define tr(x,it) for(auto it : x)
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230
#define bs(status,lo,hi,mid) {cerr<<#status<<"="<<status<<" "<<#lo<<"="<<lo<<" "<<#hi<<"="<<hi<<" "<<#mid<<"="<<mid<<endl;}
#define trace(x) {cerr << #x << "=" << x <<endl;}
#define trace2(x, y) {cerr << #x << "=" << x << " " << #y << "=" << y <<endl;}
using namespace std;
template <typename T> ostream& operator<<(ostream& os, const vector<T> &p){os << "[ "; for (T x: p) os << x << " "; os << "]" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const set<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const map<Tk, Tv> &p){os << "{ "; for (pair<Tk, Tv> x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const pair<Tk, Tv> &p){os << "{" << p.first << ',' << p.second << "}";return os;}
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n&1) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n&1) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

const int N=200005;
int a[2*N],b[2*N];

int main()
{
   int i,j;
   int sz=1;
   double sum=0;
   int n;
   si(n);
   while(n--)
   {
   	int t;
   	si(t);
   	if(t==1)
   	{
   		double no,x;
   		sd(no),sd(x);
   		b[(int)no]+=x;
   		sum=(sum+x*no);
   	}
   	else if(t==2)
   	{
   		double k;
   		sd(k);
   		sum=(sum+k);
   		a[sz]=(int)k;
   		sz++;
   	}
   	else
   	{
   		sum=(sum-a[sz-1]-b[sz]);
   		sz--;
   		b[sz]+=b[sz+1];
   	}
   	pd(sum/sz);
   }
   return 0;
}


/*One Ring to rule them all, One Ring to find them,
  One Ring to bring them all, and in the darkness bind them*/
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <list>
#include <deque>
#include <bitset>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <sstream>
#include <complex>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <climits>
#include <utility>
#include <ctime>
#include <tuple>
#include <fstream>
#include <cctype>
#define FOR(i,a,n) for(i=a;i<n;i++)
#define FORD(i,a,n) for(i=a;i>=n;i--)
#define FORS(i,a) for(i=0;a[i];i++)
#define si(x) scanf("%d",&x)
#define sc(x) cin>>x
#define sd(x) scanf("%lf",&x)
#define sll(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define prs(x) printf("%d ",x)
#define pls(x) printf("%lld ",(long long)x)
#define pc(x) printf("%c",(char)x)
#define pi(x) printf("%d\n",x)
#define pd(x) printf("%.10lf\n",x);
#define pll(x) printf("%lld\n",(long long)x)
#define ps(x) printf("%s\n",x)
#define M 1000000007
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define pb push_back
#define fr first
#define se second
#define in insert
#define er erase
#define pii pair<int, int>
#define plll pair<long long, long long>
#define tr(x,it) for(auto it : x)
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230
#define bs(status,lo,hi,mid) {cerr<<#status<<"="<<status<<" "<<#lo<<"="<<lo<<" "<<#hi<<"="<<hi<<" "<<#mid<<"="<<mid<<endl;}
#define trace(x) {cerr << #x << "=" << x <<endl;}
#define trace2(x, y) {cerr << #x << "=" << x << " " << #y << "=" << y <<endl;}
using namespace std;
template <typename T> ostream& operator<<(ostream& os, const vector<T> &p){os << "[ "; for (T x: p) os << x << " "; os << "]" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const set<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const map<Tk, Tv> &p){os << "{ "; for (pair<Tk, Tv> x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const pair<Tk, Tv> &p){os << "{" << p.first << ',' << p.second << "}";return os;}
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n&1) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n&1) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

const int N=200005;
int a[2*N],b[2*N];

int main()
{
   int i,j;
   int sz=1;
   long double sum=0;
   int n;
   si(n);
   while(n--)
   {
   	int t;
   	si(t);
   	if(t==1)
   	{
   		long double no,x;
   		scanf("%Lf%Lf",&no,&x);
   		b[(int)no]+=x;
   		sum=(sum+x*no);
   	}
   	else if(t==2)
   	{
   		long double k;
   		scanf("%Lf",&k);
   		sum=(sum+k);
   		a[sz]=(int)k;
   		sz++;
   	}
   	else
   	{
   		sum=(sum-a[sz-1]-b[sz]);
   		sz--;
   		b[sz]+=b[sz+1];
   	}
   	printf("%0.9Lf\n",sum/sz);
   }
   return 0;
}


/*One Ring to rule them all, One Ring to find them,
  One Ring to bring them all, and in the darkness bind them*/
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <list>
#include <deque>
#include <bitset>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <sstream>
#include <complex>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <climits>
#include <utility>
#include <ctime>
#include <tuple>
#include <fstream>
#include <cctype>
#define FOR(i,a,n) for(i=a;i<n;i++)
#define FORD(i,a,n) for(i=a;i>=n;i--)
#define FORS(i,a) for(i=0;a[i];i++)
#define si(x) scanf("%d",&x)
#define sc(x) cin>>x
#define sd(x) scanf("%lf",&x)
#define sll(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define prs(x) printf("%d ",x)
#define pls(x) printf("%lld ",(long long)x)
#define pc(x) printf("%c",(char)x)
#define pi(x) printf("%d\n",x)
#define pd(x) printf("%.9lf\n",x);
#define pll(x) printf("%lld\n",(long long)x)
#define ps(x) printf("%s\n",x)
#define M 1000000007
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define pb push_back
#define fr first
#define se second
#define in insert
#define er erase
#define pii pair<int, int>
#define plll pair<long long, long long>
#define tr(x,it) for(auto it : x)
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230
#define bs(status,lo,hi,mid) {cerr<<#status<<"="<<status<<" "<<#lo<<"="<<lo<<" "<<#hi<<"="<<hi<<" "<<#mid<<"="<<mid<<endl;}
#define trace(x) {cerr << #x << "=" << x <<endl;}
#define trace2(x, y) {cerr << #x << "=" << x << " " << #y << "=" << y <<endl;}
using namespace std;
template <typename T> ostream& operator<<(ostream& os, const vector<T> &p){os << "[ "; for (T x: p) os << x << " "; os << "]" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const set<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const map<Tk, Tv> &p){os << "{ "; for (pair<Tk, Tv> x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const pair<Tk, Tv> &p){os << "{" << p.first << ',' << p.second << "}";return os;}
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n&1) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n&1) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

const int N=200005;
int a[2*N],b[2*N];

int main()
{
   int i,j;
   int sz=1;
   double avg=0;
   int n;
   si(n);
   while(n--)
   {
   	int t;
   	si(t);
   	if(t==1)
   	{
   		double no,x;
   		sd(no),sd(x);
   		b[(int)no]+=x;
   		avg=(avg*sz+x*no)/sz;
   	}
   	else if(t==2)
   	{
   		double k;
   		sd(k);
   		avg=(avg*sz+k)/(sz+1);
   		a[sz]=(int)k;
   		sz++;
   	}
   	else
   	{
   		avg=(avg*sz-a[sz-1]-b[sz])/(sz-1);
   		sz--;
   		b[sz]+=b[sz+1];
   	}
   	pd(avg);
   }
   return 0;
}


/*One Ring to rule them all, One Ring to find them,
  One Ring to bring them all, and in the darkness bind them*/
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <list>
#include <deque>
#include <bitset>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <sstream>
#include <complex>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <climits>
#include <utility>
#include <ctime>
#include <tuple>
#include <fstream>
#include <cctype>
#define FOR(i,a,n) for(i=a;i<n;i++)
#define FORD(i,a,n) for(i=a;i>=n;i--)
#define FORS(i,a) for(i=0;a[i];i++)
#define si(x) scanf("%d",&x)
#define sc(x) cin>>x
#define sd(x) scanf("%lf",&x)
#define sll(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define prs(x) printf("%d ",x)
#define pls(x) printf("%lld ",(long long)x)
#define pc(x) printf("%c",(char)x)
#define pi(x) printf("%d\n",x)
#define pd(x)
#define pll(x) printf("%lld\n",(long long)x)
#define ps(x) printf("%s\n",x)
#define M 1000000007
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define pb push_back
#define fr first
#define se second
#define in insert
#define er erase
#define pii pair<int, int>
#define plll pair<long long, long long>
#define tr(x,it) for(auto it : x)
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230
#define bs(status,lo,hi,mid) {cerr<<#status<<"="<<status<<" "<<#lo<<"="<<lo<<" "<<#hi<<"="<<hi<<" "<<#mid<<"="<<mid<<endl;}
#define trace(x) {cerr << #x << "=" << x <<endl;}
#define trace2(x, y) {cerr << #x << "=" << x << " " << #y << "=" << y <<endl;}
using namespace std;
template <typename T> ostream& operator<<(ostream& os, const vector<T> &p){os << "[ "; for (T x: p) os << x << " "; os << "]" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const set<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const map<Tk, Tv> &p){os << "{ "; for (pair<Tk, Tv> x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const pair<Tk, Tv> &p){os << "{" << p.first << ',' << p.second << "}";return os;}
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n&1) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n&1) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

const int N=200005;
int a[2*N],b[2*N];

int main()
{
   int i,j;
   int sz=1;
   double avg=0;
   int n;
   si(n);
   cout.precision(10);
   while(n--)
   {
   	int t;
   	si(t);
   	if(t==1)
   	{
   		double no,x;
   		sd(no),sd(x);
   		b[(int)no]+=x;
   		avg=(avg*sz+x*no)/sz;
   	}
   	else if(t==2)
   	{
   		double k;
   		sd(k);
   		avg=(avg*sz+k)/(sz+1);
   		a[sz]=(int)k;
   		sz++;
   	}
   	else
   	{
   		avg=(avg*sz-a[sz-1]-b[sz])/(sz-1);
   		sz--;
   		b[sz]+=b[sz+1];
   		b[sz+1]=0;
   	}
   	// trace(sz);
   	// FOR(i,0,sz)
   	// 	prs(a[i]);
   	// puts("");
   	cout<<fixed<<avg<<"\n";
   }
   return 0;
}


/*One Ring to rule them all, One Ring to find them,
  One Ring to bring them all, and in the darkness bind them*/
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <list>
#include <deque>
#include <bitset>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <sstream>
#include <complex>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <climits>
#include <utility>
#include <ctime>
#include <tuple>
#include <fstream>
#include <cctype>
#define FOR(i,a,n) for(i=a;i<n;i++)
#define FORD(i,a,n) for(i=a;i>=n;i--)
#define FORS(i,a) for(i=0;a[i];i++)
#define si(x) scanf("%d",&x)
#define sc(x) cin>>x
#define sd(x) scanf("%lf",&x)
#define sll(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define prs(x) printf("%d ",x)
#define pls(x) printf("%lld ",(long long)x)
#define pc(x) printf("%c",(char)x)
#define pi(x) printf("%d\n",x)
#define pd(x) printf("%.10lf\n",x);
#define pll(x) printf("%lld\n",(long long)x)
#define ps(x) printf("%s\n",x)
#define M 1000000007
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define pb push_back
#define fr first
#define se second
#define in insert
#define er erase
#define pii pair<int, int>
#define plll pair<long long, long long>
#define tr(x,it) for(auto it : x)
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230
#define bs(status,lo,hi,mid) {cerr<<#status<<"="<<status<<" "<<#lo<<"="<<lo<<" "<<#hi<<"="<<hi<<" "<<#mid<<"="<<mid<<endl;}
#define trace(x) {cerr << #x << "=" << x <<endl;}
#define trace2(x, y) {cerr << #x << "=" << x << " " << #y << "=" << y <<endl;}
using namespace std;
template <typename T> ostream& operator<<(ostream& os, const vector<T> &p){os << "[ "; for (T x: p) os << x << " "; os << "]" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const set<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const map<Tk, Tv> &p){os << "{ "; for (pair<Tk, Tv> x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const pair<Tk, Tv> &p){os << "{" << p.first << ',' << p.second << "}";return os;}
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n&1) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n&1) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

const int N=200005;
int a[2*N],b[2*N];

int main()
{
   int i,j;
   int sz=1;
   double sum=0;
   int n;
   si(n);
   while(n--)
   {
   	int t;
   	si(t);
   	if(t==1)
   	{
   		double no,x;
   		scanf("%lf%lf",&no,&x);
   		b[(int)no]+=x;
   		sum=(sum+x*no);
   	}
   	else if(t==2)
   	{
   		double k;
   		scanf("%lf",&k);
   		sum=(sum+k);
   		a[sz]=(int)k;
   		sz++;
   	}
   	else
   	{
   		sum=(sum-a[sz-1]-b[sz]);
   		sz--;
   		b[sz]+=b[sz+1];
   		b[sz+1]=0;
   	}
   	printf("%0.9lf\n",sum/sz);
   }
   return 0;
}


/*One Ring to rule them all, One Ring to find them,
  One Ring to bring them all, and in the darkness bind them*/
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <list>
#include <deque>
#include <bitset>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <sstream>
#include <complex>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <climits>
#include <utility>
#include <ctime>
#include <tuple>
#include <fstream>
#include <cctype>
#define FOR(i,a,n) for(i=a;i<n;i++)
#define FORD(i,a,n) for(i=a;i>=n;i--)
#define FORS(i,a) for(i=0;a[i];i++)
#define si(x) scanf("%d",&x)
#define sc(x) cin>>x
#define sd(x) scanf("%lf",&x)
#define sll(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define prs(x) printf("%d ",x)
#define pls(x) printf("%lld ",(long long)x)
#define pc(x) printf("%c",(char)x)
#define pi(x) printf("%d\n",x)
#define pd(x) printf("%.10lf\n",x);
#define pll(x) printf("%lld\n",(long long)x)
#define ps(x) printf("%s\n",x)
#define M 1000000007
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define pb push_back
#define fr first
#define se second
#define in insert
#define er erase
#define pii pair<int, int>
#define plll pair<long long, long long>
#define tr(x,it) for(auto it : x)
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230
#define bs(status,lo,hi,mid) {cerr<<#status<<"="<<status<<" "<<#lo<<"="<<lo<<" "<<#hi<<"="<<hi<<" "<<#mid<<"="<<mid<<endl;}
#define trace(x) {cerr << #x << "=" << x <<endl;}
#define trace2(x, y) {cerr << #x << "=" << x << " " << #y << "=" << y <<endl;}
using namespace std;
template <typename T> ostream& operator<<(ostream& os, const vector<T> &p){os << "[ "; for (T x: p) os << x << " "; os << "]" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const set<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const map<Tk, Tv> &p){os << "{ "; for (pair<Tk, Tv> x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const pair<Tk, Tv> &p){os << "{" << p.first << ',' << p.second << "}";return os;}
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n&1) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n&1) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

const int N=200005;
int a[2*N],b[2*N];

int main()
{
   int i,j;
   int sz=1;
   double sum=0;
   int n;
   si(n);
   while(n--)
   {
   	int t;
   	si(t);
   	if(t==1)
   	{
   		double no,x;
   		sd(no),sd(x);
   		b[(int)no]+=x;
   		sum=(sum+x*no);
   	}
   	else if(t==2)
   	{
   		double k;
   		sd(k);
   		sum=(sum+k);
   		a[sz]=(int)k;
   		sz++;
   	}
   	else
   	{
   		sum=(sum-a[sz-1]-b[sz]);
   		sz--;
   		b[sz]+=b[sz+1];
   	}
   	pd(sum/sz);
   }
   return 0;
}


/*One Ring to rule them all, One Ring to find them,
  One Ring to bring them all, and in the darkness bind them*/
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <list>
#include <deque>
#include <bitset>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <sstream>
#include <complex>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <climits>
#include <utility>
#include <ctime>
#include <tuple>
#include <fstream>
#include <cctype>
#define FOR(i,a,n) for(i=a;i<n;i++)
#define FORD(i,a,n) for(i=a;i>=n;i--)
#define FORS(i,a) for(i=0;a[i];i++)
#define si(x) scanf("%d",&x)
#define sc(x) cin>>x
#define sd(x) scanf("%lf",&x)
#define sll(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define prs(x) printf("%d ",x)
#define pls(x) printf("%lld ",(long long)x)
#define pc(x) printf("%c",(char)x)
#define pi(x) printf("%d\n",x)
#define pll(x) printf("%lld\n",(long long)x)
#define ps(x) printf("%s\n",x)
#define M 1000000007
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define pb push_back
#define fr first
#define se second
#define in insert
#define er erase
#define pii pair<int, int>
#define plll pair<long long, long long>
#define tr(x,it) for(auto it : x)
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230
#define bs(status,lo,hi,mid) {cerr<<#status<<"="<<status<<" "<<#lo<<"="<<lo<<" "<<#hi<<"="<<hi<<" "<<#mid<<"="<<mid<<endl;}
#define trace(x) {cerr << #x << "=" << x <<endl;}
#define trace2(x, y) {cerr << #x << "=" << x << " " << #y << "=" << y <<endl;}
using namespace std;
template <typename T> ostream& operator<<(ostream& os, const vector<T> &p){os << "[ "; for (T x: p) os << x << " "; os << "]" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const set<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const map<Tk, Tv> &p){os << "{ "; for (pair<Tk, Tv> x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const pair<Tk, Tv> &p){os << "{" << p.first << ',' << p.second << "}";return os;}
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n&1) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n&1) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

const int N=200005;
int a[2*N],b[2*N];

int main()
{
   int i,j;
   int sz=1;
   double avg=0;
   int n;
   si(n);
   cout.precision(15);
   while(n--)
   {
   	int t;
   	si(t);
   	if(t==1)
   	{
   		double no,x;
   		sd(no),sd(x);
   		b[(int)no]+=x;
   		avg=(avg*sz+x*no)/sz;
   	}
   	else if(t==2)
   	{
   		double k;
   		sd(k);
   		avg=(avg*sz+k)/(sz+1);
   		a[sz]=(int)k;
   		sz++;
   	}
   	else
   	{
   		avg=(avg*sz-a[sz-1]-b[sz])/(sz-1);
   		sz--;
   		assert(sz>0);
   		b[sz]+=b[sz+1];
   	}
   	cout<<fixed<<avg<<"\n";
   }
   return 0;
}


/*One Ring to rule them all, One Ring to find them,
  One Ring to bring them all, and in the darkness bind them*/
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <list>
#include <deque>
#include <bitset>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <sstream>
#include <complex>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <climits>
#include <utility>
#include <ctime>
#include <tuple>
#include <fstream>
#include <cctype>
#define FOR(i,a,n) for(i=a;i<n;i++)
#define FORD(i,a,n) for(i=a;i>=n;i--)
#define FORS(i,a) for(i=0;a[i];i++)
#define si(x) scanf("%d",&x)
#define sc(x) cin>>x
#define sd(x) scanf("%lf",&x)
#define sll(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define prs(x) printf("%d ",x)
#define pls(x) printf("%lld ",(long long)x)
#define pc(x) printf("%c",(char)x)
#define pi(x) printf("%d\n",x)
#define pd(x) cout.precision(10),cout<<fixed<<x<<endl;
#define pll(x) printf("%lld\n",(long long)x)
#define ps(x) printf("%s\n",x)
#define M 1000000007
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define pb push_back
#define fr first
#define se second
#define in insert
#define er erase
#define pii pair<int, int>
#define plll pair<long long, long long>
#define tr(x,it) for(auto it : x)
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230
#define bs(status,lo,hi,mid) {cerr<<#status<<"="<<status<<" "<<#lo<<"="<<lo<<" "<<#hi<<"="<<hi<<" "<<#mid<<"="<<mid<<endl;}
#define trace(x) {cerr << #x << "=" << x <<endl;}
#define trace2(x, y) {cerr << #x << "=" << x << " " << #y << "=" << y <<endl;}
using namespace std;
template <typename T> ostream& operator<<(ostream& os, const vector<T> &p){os << "[ "; for (T x: p) os << x << " "; os << "]" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const set<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const map<Tk, Tv> &p){os << "{ "; for (pair<Tk, Tv> x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const pair<Tk, Tv> &p){os << "{" << p.first << ',' << p.second << "}";return os;}
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n&1) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n&1) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

const int N=200005;
int a[2*N],b[2*N];

int main()
{
   int i,j;
   int sz=1;
   double avg=0;
   int n;
   si(n);
   while(n--)
   {
   	int t;
   	si(t);
   	if(t==1)
   	{
   		double no,x;
   		sd(no),sd(x);
   		b[(int)no]+=x;
   		avg=(avg*sz+x*no)/sz;
   	}
   	else if(t==2)
   	{
   		double k;
   		sd(k);
   		avg=(avg*sz+k)/(sz+1);
   		a[sz]=(int)k;
   		sz++;
   	}
   	else
   	{
   		avg=(avg*sz-a[sz-1]-b[sz])/(sz-1);
   		sz--;
   		assert(sz>0);
   		b[sz]+=b[sz+1];
   	}
   	pd(avg);
   }
   return 0;
}


/*One Ring to rule them all, One Ring to find them,
  One Ring to bring them all, and in the darkness bind them*/
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <list>
#include <deque>
#include <bitset>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <sstream>
#include <complex>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <climits>
#include <utility>
#include <ctime>
#include <tuple>
#include <fstream>
#include <cctype>
#define FOR(i,a,n) for(i=a;i<n;i++)
#define FORD(i,a,n) for(i=a;i>=n;i--)
#define FORS(i,a) for(i=0;a[i];i++)
#define si(x) scanf("%d",&x)
#define sc(x) cin>>x
#define sd(x) scanf("%lf",&x)
#define sll(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define prs(x) printf("%d ",x)
#define pls(x) printf("%lld ",(long long)x)
#define pc(x) printf("%c",(char)x)
#define pi(x) printf("%d\n",x)
#define pd(x) cout.precision(10),cout<<fixed<<x<<endl;
#define pll(x) printf("%lld\n",(long long)x)
#define ps(x) printf("%s\n",x)
#define M 1000000007
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define pb push_back
#define fr first
#define se second
#define in insert
#define er erase
#define pii pair<int, int>
#define plll pair<long long, long long>
#define tr(x,it) for(auto it : x)
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230
#define bs(status,lo,hi,mid) {cerr<<#status<<"="<<status<<" "<<#lo<<"="<<lo<<" "<<#hi<<"="<<hi<<" "<<#mid<<"="<<mid<<endl;}
#define trace(x) {cerr << #x << "=" << x <<endl;}
#define trace2(x, y) {cerr << #x << "=" << x << " " << #y << "=" << y <<endl;}
using namespace std;
template <typename T> ostream& operator<<(ostream& os, const vector<T> &p){os << "[ "; for (T x: p) os << x << " "; os << "]" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const set<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const map<Tk, Tv> &p){os << "{ "; for (pair<Tk, Tv> x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const pair<Tk, Tv> &p){os << "{" << p.first << ',' << p.second << "}";return os;}
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n&1) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n&1) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

const int N=200005;
int a[2*N],b[2*N];

int main()
{
   int i,j;
   int sz=1;
   double avg=0;
   int n;
   si(n);
   while(n--)
   {
   	int t;
   	si(t);
   	if(t==1)
   	{
   		double no,x;
   		sd(no),sd(x);
   		b[(int)no]+=x;
   		avg=(avg*sz+x*no)/sz;
   	}
   	else if(t==2)
   	{
   		double k;
   		sd(k);
   		avg=(avg*sz+k)/(sz+1);
   		a[sz]=(int)k;
   		sz++;
   	}
   	else
   	{
   		avg=(avg*sz-a[sz-1]-b[sz])/(sz-1);
   		sz--;
   		b[sz]+=b[sz+1];
   	}
   	// trace(sz);
   	// FOR(i,0,sz)
   	// 	prs(a[i]);
   	// puts("");
   	pd(avg);
   }
   return 0;
}


#include <bits/stdc++.h>
using namespace std;
vector<double>vs;
vector<double>outs;
double finals[200005];
double vs[200005];
int main(){
    int n,t,x,y,c = 0;
    double  total = 0.0;
    cin >> n;
    vs.push_back(0);
int siz = 1;
    for(int i = 0;i < n;i++){
        cin >> t;
        if (t == 1) {
            int a, x;
            cin >> x >>y;
            finals[x]+=(double)y;
            total += (double)(y) * (double)(x);
        } else if (t == 2) {
            int k;
                cin >> x;
                vs[++siz] = x;
                total+=(double)x;
        } else {
                 total-=(double)vs[siz];
                 total-=(double)finals[siz];
              finals[siz-1] += finals[siz];
                vs[siz] = 0.0;
                finals[siz] = 0.0;
                siz--;
    }
       printf("%.10lf\n", (double)(total) / (double)(vs.size()));
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
vector<int>vs;
vector<double>outs;
int finals[200005];
int main(){
    int n,t,x,y,c = 0;
    long long  total = 0;
    cin >> n;
    vs.push_back(0);

    for(int i = 0;i < n;i++){
        cin >> t;
        if(t == 1){
            cin >> x >>y;
   //         for(int i = 0;i < x;i++)vs[i]+=y;
            finals[x-1]+=y;
            total+=(y*x);
            }else if(t == 2){
                cin >> x;
                vs.push_back(x);
                total+=x;
            }else {
                 total-=(vs.back()+finals[vs.size()-1]);
              finals[vs.size()-2] += finals[vs.size()-1];
                 vs.pop_back();
            }
//cout<<"** ";
     //     for(int j = 0;j < vs.size();j++)c+=vs[j],cout<<vs[j]<<' ';
  //              cout<<endl<<c<<" "<<vs.size()<<" "<<(double)(c/vs.size())<<endl;
            printf("%.9llf\n",(double)total/(double)vs.size());
            c = 0;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
vector<int>vs;
vector<double>outs;
int finals[200005];
int main(){
    int n,t,x,y,c = 0;
    double  total = 0.0;
    cin >> n;
    vs.push_back(0);
int s = 1;
    for(int i = 0;i < n;i++){
        cin >> t;
        if(t == 1){
            cin >> x >>y;
   //         for(int i = 0;i < x;i++)vs[i]+=y;
            finals[x]+=y;
            total+=((double)y*(double)x);
            }else if(t == 2){
                cin >> x;
                vs.push_back(x);
                total+=(double)x;
                s++;
            }else {
                 total-=(vs.back()+finals[s]);
              finals[s-1] += finals[s];
                 vs.pop_back();
                 s--;
            }
//cout<<"** ";
     //     for(int j = 0;j < vs.size();j++)c+=vs[j],cout<<vs[j]<<' ';
  //              cout<<endl<<c<<" "<<vs.size()<<" "<<(double)(c/vs.size())<<endl;
//            printf("%.10lf\n",(double)total/(double)vs.size());
printf("%.10lf\n", (double)(total) / (double)(s));
            c = 0;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
vector<int>vs;
vector<double>outs;
int main(){
    int n,t,x,y,c = 0;
    long long  total = 0;
    cin >> n;
    vs.push_back(0);

    for(int i = 0;i < n;i++){
        cin >> t;
        if(t == 1){
            cin >> x >>y;
            for(int i = 0;i < x;i++)vs[i]+=y;
            total+=(y*x);
            }else if(t == 2){
                cin >> x;
                vs.push_back(x);
                total+=x;
            }else  total-=vs.back(),vs.pop_back();
//cout<<"** ";
     //     for(int j = 0;j < vs.size();j++)c+=vs[j],cout<<vs[j]<<' ';
  //              cout<<endl<<c<<" "<<vs.size()<<" "<<(double)(c/vs.size())<<endl;
            printf("%.6llf\n",(double)total/(double)vs.size());
            c = 0;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
vector<int>vs;
vector<double>outs;
int finals[200005];
int main(){
    int n,t,x,y,c = 0;
    double  total = 0.0;
    cin >> n;
    vs.push_back(0);
int s = 1;
    for(int i = 0;i < n;i++){
        cin >> t;
        if(t == 1){
            cin >> x >>y;
   //         for(int i = 0;i < x;i++)vs[i]+=y;
            finals[x]+=y;
            total+=((double)y*(double)x);
            }else if(t == 2){
                cin >> x;
                vs.push_back(x);
                total+=(double)x;
                s++;
            }else {
                 total-=((double)vs.back()+(double)finals[s]);
              finals[s-1] += finals[s];
                 vs.pop_back();
                 s--;
            }
//cout<<"** ";
     //     for(int j = 0;j < vs.size();j++)c+=vs[j],cout<<vs[j]<<' ';
  //              cout<<endl<<c<<" "<<vs.size()<<" "<<(double)(c/vs.size())<<endl;
//            printf("%.10lf\n",(double)total/(double)vs.size());
printf("%.10lf\n", (double)(total) / (double)(s));
            c = 0;
    }

    return 0;
}