#include <bits/stdc++.h>
using namespace std;
vector<long long> in, ad;
int main() {
  ad.resize(1);
  in.resize(1);
  in[0] = ad[0] = 0;
  long long sm = 0;
  long long le = 1;
  int n;
  cin >> n;
  for (int i = (0); i < int(n); i += 1) {
    long long c;
    cin >> c;
    if (c == 1) {
      long long a, x;
      cin >> a >> x;
      sm += a * x;
      ad[a - 1] += x;
    } else if (c == 2) {
      long long k;
      cin >> k;
      sm += k;
      ad.push_back(0);
      in.push_back(k);
      le++;
    } else if (c == 3) {
      assert(le >= 2);
      long long ch = ad.back();
      sm -= in.back();
      sm -= ch;
      in.pop_back();
      ad.pop_back();
      ad.back() += ch;
      le--;
    } else
      assert(0);
    printf("%.9f\n", (double)sm / (double)le);
  }
  return 0;
}
