#include <bits/stdc++.h>
using namespace std;
int n;
long long a[200100];
long long t[800800];
long long d[800800];
void build(int v, int tl, int tr) {
  if (tl == tr) {
    t[v] = a[tl];
  } else {
    int tm = (tl + tr) / 2;
    build(2 * v, tl, tm);
    build(2 * v + 1, tm + 1, tr);
    t[v] = t[2 * v] + t[2 * v + 1];
  }
}
int ind(int v, int tl, int tr, int pos) {
  if (tl == tr) {
    return v;
  } else {
    int tm = (tl + tr) / 2;
    if (pos <= tm) {
      return ind(2 * v, tl, tm, pos);
    } else {
      return ind(2 * v + 1, tm + 1, tr, pos);
    }
  }
}
void push(int v, int tl, int tr) {
  if (d[v] != 0 && 2 * v + 1 < 800800) {
    d[2 * v] += d[v];
    d[2 * v + 1] += d[v];
    int tm = (tl + tr) / 2;
    t[2 * v] += (tm - tl + 1) * d[v];
    t[2 * v + 1] += (tr - tm) * d[v];
    d[v] = 0;
  }
}
long long sum(int v, int tl, int tr, int l, int r) {
  if (l <= tl && tr <= r) {
    return t[v];
  }
  if (l > tr || tl > r) {
    return 0;
  }
  int tm = (tl + tr) / 2;
  push(v, tl, tr);
  return sum(2 * v, tl, tm, l, r) + sum(2 * v + 1, tm + 1, tr, l, r);
}
void update(int v, int tl, int tr, int l, int r, int x) {
  if (l <= tl && tr <= r) {
    d[v] += x;
    t[v] += (tr - tl + 1) * x;
    return;
  }
  if (l > tr || tl > r) {
    return;
  }
  int tm = (tl + tr) / 2;
  push(v, tl, tr);
  update(2 * v, tl, tm, l, r, x);
  update(2 * v + 1, tm + 1, tr, l, r, x);
  t[v] = t[2 * v] + t[2 * v + 1];
}
void update_new_val(int v, int tl, int tr, int pos, int new_val) {
  if (tl == tr) {
    t[v] = new_val;
  } else {
    int tm = (tl + tr) / 2;
    push(v, tl, tr);
    if (pos <= tm) {
      update_new_val(2 * v, tl, tm, pos, new_val);
    } else {
      update_new_val(2 * v + 1, tm + 1, tr, pos, new_val);
    }
    t[v] = t[2 * v] + t[2 * v + 1];
  }
}
int main() {
  for (int i = 0; i < 200100; i++) {
    a[i] = 0;
  }
  scanf("%d", &n);
  long long l = 1;
  for (int i = 0; i < 800800; i++) {
    d[i] = 0;
  }
  build(1, 0, 200099);
  for (int i = 0; i < n; i++) {
    int z;
    scanf("%d", &z);
    if (z == 1) {
      int k;
      long long x;
      cin >> k >> x;
      if (x != 0) {
        update(1, 0, 200099, 0, k - 1, x);
      }
    }
    if (z == 2) {
      long long new_val;
      cin >> new_val;
      update_new_val(1, 0, 200099, l, new_val);
      l++;
    }
    if (z == 3) {
      update_new_val(1, 0, 200099, l - 1, 0);
      l--;
    }
    long long s = sum(1, 0, 200099, 0, 200099);
    double q = l * 1.0;
    double sr = (1.0 * s) / q;
    printf("%.10f\n", sr);
  }
  return 0;
}
