#include <bits/stdc++.h>
using namespace std;
priority_queue<pair<long long, long long>, vector<pair<long long, long long> >,
               greater<pair<long long, long long> > >
    pq;
priority_queue<long long, vector<long long>, greater<long long> > pq1;
long long result(long long a, long long b, long long p) {
  long long ans = 1;
  if (b == (-1)) b = p - 2;
  while (b) {
    if (b & 1) {
      ans = (ans * a) % p;
    }
    a = (a * a) % p;
    b >>= 1;
  }
  return ans;
}
long long T = 1, n, m, k;
int main() {
  if (fopen("input.txt", "r"))
    freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> T;
  long long count = 0;
  map<long long, long long> m;
  double sum = 0;
  double ans = 0;
  long long arr[200010];
  arr[1] = 0;
  long long d = 2, p;
  count = 1;
  while (T--) {
    long long a, b, c;
    cin >> a;
    switch (a) {
      case 1:
        cin >> b >> c;
        m[b] += c;
        sum += b * c;
        ans = sum / count;
        cout << setprecision(50) << ans << "\n";
        break;
      case 2:
        cin >> b;
        arr[d] = b;
        d++;
        sum += b;
        count++;
        ans = sum / count;
        cout << setprecision(50) << ans << "\n";
        break;
      case 3:
        d--;
        count--;
        sum -= arr[d];
        p = m[d];
        sum -= p;
        m[d - 1] += p;
        m[d] = 0;
        if (count == 0)
          ans = 0;
        else
          ans = sum / count;
        cout << setprecision(50) << ans << "\n";
        break;
      default:
        break;
    }
  }
  return 0;
}
