#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, t, k, a, x, y, i;
  cin >> n;
  double s = 0, m;
  vector<long long> v, b(200001);
  v.push_back(0);
  while (n--) {
    cin >> t;
    if (t == 1) {
      cin >> a >> x;
      if (v.size() <= a)
        y = v.size();
      else if (a < v.size())
        y = a;
      b[y] += x;
      s += (x * y);
      m = v.size();
      cout << fixed << setprecision(12) << (s / m) << "\n";
    } else if (t == 2) {
      cin >> k;
      v.push_back(k);
      s += k;
      m = v.size();
      cout << fixed << setprecision(12) << (s / m) << "\n";
    } else if (t == 3) {
      s -= v.back();
      s -= b[v.size()];
      b[v.size() - 1] += b[v.size()];
      b[v.size()] = 0;
      v.pop_back();
      m = v.size();
      cout << fixed << setprecision(12) << (s / m) << "\n";
    }
  }
  return 0;
}
