#include <bits/stdc++.h>
using namespace std;
int a[200001];
int main() {
  vector<int> v;
  v.push_back(0);
  double sum = 0;
  int n, t, x, y;
  cin >> n;
  while (n--) {
    cin >> t;
    if (t == 1) {
      cin >> x >> y;
      sum += (double)x * y;
      a[x - 1] += y;
    }
    if (t == 2) {
      cin >> x;
      sum += (double)x;
      v.push_back(x);
    }
    if (t == 3) {
      if (a[v.size() - 1] == 0) {
        sum -= (double)v[v.size() - 1];
        v.pop_back();
      } else {
        sum -= (double)v[v.size() - 1];
        sum -= (double)a[v.size() - 1];
        a[v.size() - 2] += a[v.size() - 1];
        a[v.size() - 1] = 0;
        v.pop_back();
      }
    }
    printf("%.6lf\n", sum / (double)v.size());
  }
  return 0;
}
