#include <bits/stdc++.h>
using namespace std;
int q, a, b, c, n;
double mean = 0;
stack<int> arr;
int add[200005] = {};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  n = 1;
  cin >> q;
  while (q--) {
    cin >> a;
    if (a == 1) {
      cin >> b >> c;
      mean += (double)(b) * (double)(c);
      add[b - 1] += c;
    } else if (a == 2) {
      cin >> b;
      mean += (double)(b);
      arr.push(b);
      n++;
    } else {
      mean = mean - (arr.top() + add[n - 1]);
      arr.pop();
      n--;
      add[n - 1] += add[n];
      add[n] = 0;
    }
    cout << setprecision(10) << fixed << mean / n << '\n';
  }
  return 0;
}
