#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long int> v, t;
  v.push_back(0), t.push_back(0);
  long long int sum = 0, tt = 1, x = 0;
  double result = 0;
  long long int ix, a, b;
  for (int i = 0; i < n; ++i) {
    cin >> ix;
    if (ix == 1) {
      cin >> a >> b;
      t[a - 1] += b;
      sum += a * b;
    } else if (ix == 2) {
      cin >> a;
      v.push_back(a), t.push_back(0);
      sum += a;
      ++tt;
    } else {
      t[t.size() - 2] += t.back();
      sum -= (v.back() + t.back());
      --tt;
      v.pop_back(), t.pop_back();
    }
    result = (double)sum / (double)tt;
    cout << fixed << setprecision(6) << result << '\n';
  }
}
