#include <bits/stdc++.h>
using namespace std;
long long a[250000], b[250000], n, q, tn, x, s = 0, v;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> q;
  tn = 1;
  while (q--) {
    long long t;
    cin >> t;
    if (t == 1) {
      cin >> x >> v;
      b[0] -= v;
      b[x] += v;
      s += v * x;
      double ans = s;
      ans /= tn;
      cout << setprecision(12) << fixed << ans << endl;
    }
    if (t == 2) {
      cin >> x;
      a[++tn] = x;
      s += x;
      double ans = s;
      ans /= tn;
      cout << setprecision(12) << fixed << ans << endl;
    }
    if (t == 3) {
      s -= a[tn] + b[tn];
      b[tn - 1] += b[tn];
      b[tn] = 0;
      a[tn--] = 0;
      double ans = s;
      ans /= tn;
      cout << setprecision(12) << fixed << ans << endl;
    }
  }
}
