#include <bits/stdc++.h>
using namespace std;
int add[1000000];
vector<int> vals;
int main() {
  fill(add, add + 1000000, 0);
  vals.push_back(0);
  long long total = 0;
  std::cout.setf(std::ios::fixed);
  std::cout.precision(7);
  int tc;
  cin >> tc;
  while (tc--) {
    int type;
    cin >> type;
    if (type == 1) {
      int a, x;
      cin >> a >> x;
      total += a * x;
      add[a - 1] += x;
    } else if (type == 2) {
      int k;
      cin >> k;
      vals.push_back(k);
      total += k;
    } else {
      add[vals.size() - 2] += add[vals.size() - 1];
      total -= vals[vals.size() - 1];
      total -= add[vals.size() - 1];
      add[vals.size() - 1] = 0;
      vals.pop_back();
    }
    cout << (total / (1.0 * vals.size())) << endl;
    ;
  }
  return 0;
}
