#include <bits/stdc++.h>
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(8)<<(x)
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define inf std::numeric_limits<int>::max();
#define highest_2_pow(n)  __builtin_clzll((long long)0)- __builtin_clzll((long long)n) - 1
//-----------------------------------------------------------------------------------------------------
#define lli long long int
#define int long long
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define vi vector<int>
#define vlli vector<long long int>
#define si set<int>
#define slli set<long long int>
#define mt make_tuple
#define mp make_pair
#define eb emplace_back
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll
//---------------------------------------------------
using namespace std;
// GCD and LCM are available
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << endl;
err(++it, args...);
}

void faster(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
void solve(){
    int n;
    cin>>n;
    int tp;
    vi pref(n+1,0);
    vi arr(n+1,0);
    vi del(n+1,0);
    int ind = 0;
    int x,k,a;
    int sm=0;
    rep(i,0,n){
        cin>>tp;
        if(tp==1){
            cin>>a>>x;
            sm+=a*x;
            del[a-1] += x;
        }
        else if (tp==2){
            cin>>k;
            sm+=k;
            arr[++ind] = k;
        }
        else{
            int val = arr[ind] + del[ind];
            arr[ind] = 0;
            del[ind] = 0;
            ind--;
            sm-=val;
            del[ind] += del[ind+1];
        }
        //error(sm,ind,del[1],arr[1]);
        cout<<FIXED_FLOAT(((double)sm)/(ind+1))<<endl;
    }
}
signed main()
{
    faster();
    int t=1;
    //cin>>t;
    while(t--) solve();
}


#include <bits/stdc++.h>
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(5)<<(x)
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define inf std::numeric_limits<int>::max();
#define highest_2_pow(n)  __builtin_clzll((long long)0)- __builtin_clzll((long long)n) - 1
//-----------------------------------------------------------------------------------------------------
#define lli long long int
#define int long long
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define vi vector<int>
#define vlli vector<long long int>
#define si set<int>
#define slli set<long long int>
#define mt make_tuple
#define mp make_pair
#define eb emplace_back
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll
//---------------------------------------------------
using namespace std;
// GCD and LCM are available
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << endl;
err(++it, args...);
}

void faster(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
void solve(){
    int n;
    cin>>n;
    int tp;
    vi pref(n+1,0);
    vi arr(n+1,0);
    vi del(n+1,0);
    int ind = 0;
    int x,k,a;
    int sm=0;
    rep(i,0,n){
        cin>>tp;
        if(tp==1){
            cin>>a>>x;
            sm+=a*x;
            del[a-1] += x;
        }
        else if (tp==2){
            cin>>k;
            sm+=k;
            arr[++ind] = k;
        }
        else{
            int val = arr[ind] + del[ind];
            ind--;
            sm-=val;
            del[ind] += del[ind+1];
        }
        //error(sm,ind,del[1],arr[1]);
        cout<<FIXED_FLOAT((1.0*sm)/(ind+1))<<endl;
    }
}
signed main()
{
    faster();
    int t=1;
    //cin>>t;
    while(t--) solve();
}


#include <bits/stdc++.h>
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(8)<<(x)
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define inf std::numeric_limits<int>::max();
#define highest_2_pow(n)  __builtin_clzll((long long)0)- __builtin_clzll((long long)n) - 1
//-----------------------------------------------------------------------------------------------------
#define lli long long int
#define int long long
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define vi vector<int>
#define vlli vector<long long int>
#define si set<int>
#define slli set<long long int>
#define mt make_tuple
#define mp make_pair
#define eb emplace_back
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll
//---------------------------------------------------
using namespace std;
// GCD and LCM are available
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << endl;
err(++it, args...);
}

void faster(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
void solve(){
    int n;
    cin>>n;
    int tp;
    vi pref(n+1,0);
    vi arr(n+1,0);
    vi del(n+1,0);
    int ind = 0;
    int x,k,a;
    int sm=0;
    rep(i,0,n){
        cin>>tp;
        if(tp==1){
            cin>>a>>x;
            sm+=a*x;
            del[a-1] += x;
        }
        else if (tp==2){
            cin>>k;
            sm+=k;
            arr[++ind] = k;
        }
        else{
            int val = arr[ind] + del[ind];
            ind--;
            sm-=val;
            del[ind] += del[ind+1];
            arr[ind+1] = 0;
            del[ind+1] = 0;
        }
        //error(sm,ind,del[1],arr[1]);
        cout<<FIXED_FLOAT(((double)sm)/(ind+1))<<endl;
    }
}
signed main()
{
    faster();
    int t=1;
    //cin>>t;
    while(t--) solve();
}


#include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef pair <int, int> pii;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int n, sum = 0; cin >> n;
    vector <pii> v; v.push_back({0, 0});
    for(int i = 0; i < n; ++i) {
        int t; cin >> t;
        if(t == 1) {
            int a, x; cin >> a >> x;
            v[a - 1].Y += x;
            sum += a * x;
        }
        if(t == 2) {
            int k; cin >> k;
            v.push_back({k, 0});
            sum += k;
        }
        if(t == 3) {
            int m = v.size(), x = v[m - 1].X, y = v[m - 1].Y;
            v[m - 2].Y += y;
            sum -= (x + y);
            v.pop_back();
        }
        cout << fixed << setprecision(9) << (double) sum / v.size() << "\n";
    }
}


#include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pii;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int n; cin >> n;
    ll sum = 0;
    vector <pii> v; v.push_back({0, 0});
    for(int i = 0; i < n; ++i) {
        int t; cin >> t;
        if(t == 1) {
            ll a, x; cin >> a >> x;
            v[a - 1].Y += x;
            sum += a * x;
        }
        if(t == 2) {
            ll k; cin >> k;
            v.push_back({k, 0});
            sum += k;
        }
        if(t == 3) {
            ll m = v.size(), x = v[m - 1].X, y = v[m - 1].Y;
            v[m - 2].Y += y;
            sum -= (x + y);
            v.pop_back();
        }
        cout << fixed << setprecision(9) << (double) sum / v.size() << "\n";
    }
}


#include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pii;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int n, ind = 0; cin >> n;
    ll sum = 0;
    pii v[20001];
    while(n--) {
        int t; cin >> t;
        if(t == 1) {
            ll a, x; cin >> a >> x;
            v[a - 1].Y += x;
            sum += a * x;
        }
        if(t == 2) {
            ll k; cin >> k;
            v[++ind] = {k, 0};
            sum += k;
        }
        if(t == 3) {
            ll x = v[ind].X, y = v[ind].Y;
            v[--ind].Y += y;
            sum -= (x + y);
        }
        cout << fixed << setprecision(9) << (double) sum / (ind + 1) << "\n";
    }
    cin >> n;
}


#include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pii;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int n, ind = 0; cin >> n;
    ll sum = 0;
    pii v[n + 1];
    while(n--) {
        int t; cin >> t;
        if(t == 1) {
            ll a, x; cin >> a >> x;
            v[a - 1].Y += x;
            sum += a * x;
        }
        if(t == 2) {
            ll k; cin >> k;
            v[++ind] = {k, 0};
            sum += k;
        }
        if(t == 3) {
            ll x = v[ind].X, y = v[ind].Y;
            v[--ind].Y += y;
            sum -= (x + y);
        }
        cout << fixed << setprecision(9) << (double) sum / (ind + 1) << "\n";
    }
}


#include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pii;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int n, ind = 0; cin >> n;
    ll sum = 0;
    pii v[20001];
    for(int i = 0; i < n; ++i) {
        int t; cin >> t;
        if(t == 1) {
            ll a, x; cin >> a >> x;
            v[a - 1].Y += x;
            sum += a * x;
        }
        if(t == 2) {
            ll k; cin >> k;
            v[++ind] = {k, 0};
            sum += k;
        }
        if(t == 3) {
            ll x = v[ind].X, y = v[ind].Y;
            v[ind - 1].Y += y;
            sum -= (x + y);
            v[ind--] = {0, 0};
        }
        cout << fixed << setprecision(9) << (double) sum / (ind + 1) << "\n";
    }
}


#include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pii;

int main() {
    ios_base::sync_with_stdio(false);
    //cin.tie(0), cout.tie(0);
    int n, ind = 0; cin >> n;
    ll sum = 0;
    pii v[n];
    while(n--) {
        int t; cin >> t;
        if(t == 1) {
            ll a, x; cin >> a >> x;
            v[a - 1].Y += x;
            sum += a * x;
        }
        if(t == 2) {
            ll k; cin >> k;
            v[++ind] = {k, 0};
            sum += k;
        }
        if(t == 3) {
            ll x = v[ind].X, y = v[ind].Y;
            v[--ind].Y += y;
            sum -= (x + y);
        }
        cout << fixed << setprecision(9) << (double) sum / (ind + 1) << "\n";
    }
}


#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <climits>
#include <iomanip>
#define endl "\n"
#define ll long long
using namespace std;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	double n;
	cin >> n;
	double sum = 0;
	double elements = 1;
	vector <double> d;
	double lastElement = 0;
	while(n --)
	{
		double type;
		cin >> type;

		if(type == 3 && elements >= 2)
		{
			elements --;
			sum -= lastElement;
			lastElement = lastElement - d[elements - 1];
			d.pop_back();
		}
		else if(type == 2)
		{
			double data;
			cin >> data;
			sum += data;
			elements ++;
			d.push_back(data - lastElement);
			lastElement = data;
		}
		else if(type == 1)
		{
			double index, val;
			cin >> index >> val;

			sum = sum + val * index;

			if(index == elements)
				lastElement += val;
			else
				d[index - 1]  -= val;
		}

		// cout << "No. of Elements : " << elements << endl;
		// cout << "Last Element : " << lastElement << endl;
		// cout << "Sum : " << sum << endl;
		// cout << "Elements of D : "  << " ";
		// for(double i = 0; i < d.size(); i ++)
		// 	cout << d[i] << " ";
		// cout << endl;
		double ans = (double)sum / elements;
		cout << fixed << setprecision(6) << ans << endl;
	}

}


#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <climits>
#include <iomanip>
#define endl "\n"
#define ll long long
using namespace std;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n;
	cin >> n;
	double sum = 0;
	int elements = 1;
	int d[n + 1] = {0};
	double lastElement = 0;
	while(n --)
	{
		double type;
		cin >> type;

		if(type == 3 && elements >= 2)
		{
			elements --;
			sum -= lastElement;
			lastElement = lastElement - d[elements - 1];
			d[elements - 1] = 0;
		}
		else if(type == 2)
		{
			int data;
			cin >> data;
			sum += data;
			d[elements - 1] = (data - lastElement);
			elements ++;
			lastElement = data;
		}
		else if(type == 1)
		{
			int index, val;
			cin >> index >> val;

			sum = sum + val * index;

			if(index == elements)
				lastElement += val;
			else
				d[index - 1]  -= val;
		}

		// cout << "No. of Elements : " << elements << endl;
		// cout << "Last Element : " << lastElement << endl;
		// cout << "Sum : " << sum << endl;
		// cout << "Elements of D : "  << " ";
		// for(int i = 0; i < elements; i ++)
		// 	cout << d[i] << " ";
		// cout << endl;
		double ans = (double)sum / elements;
		cout << fixed << setprecision(6) << ans << endl;
	}

}


#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <climits>
#include <iomanip>
#define endl "\n"
#define ll long long
using namespace std;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	int n;
	cin >> n;
	int sum = 0;
	int elements = 1;
	vector <int> d;
	int lastElement = 0;
	while(n --)
	{
		int type;
		cin >> type;

		if(type == 3 && elements >= 2)
		{
			elements --;
			sum -= lastElement;
			lastElement = lastElement - d[elements - 1];
			d.pop_back();
		}
		else if(type == 2)
		{
			int data;
			cin >> data;
			sum += data;
			elements ++;
			d.push_back(data - lastElement);
			lastElement = data;
		}
		else if(type == 1)
		{
			int index, val;
			cin >> index >> val;

			sum = sum + val * index;

			if(index == elements)
				lastElement += val;
			else
				d[index - 1]  -= val;
		}

		// cout << "No. of Elements : " << elements << endl;
		// cout << "Last Element : " << lastElement << endl;
		// cout << "Sum : " << sum << endl;
		// cout << "Elements of D : "  << " ";
		// for(int i = 0; i < d.size(); i ++)
		// 	cout << d[i] << " ";
		// cout << endl;
		double ans = (double)sum / elements;
		cout << fixed << setprecision(6) << ans << endl;
	}

}


#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <climits>
#include <iomanip>
#define endl "\n"
#define ll long long
using namespace std;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	double n;
	cin >> n;
	double sum = 0;
	double elements = 1;
	vector <double> d;
	double lastElement = 0;
	while(n --)
	{
		double type;
		cin >> type;

		if(type == 3 && elements >= 2)
		{
			elements --;
			sum -= lastElement;
			lastElement = lastElement - d[elements - 1];
			d.pop_back();
		}
		else if(type == 2)
		{
			double data;
			cin >> data;
			sum += data;
			elements ++;
			d.push_back(data - lastElement);
			lastElement = data;
		}
		else if(type == 1)
		{
			double index, val;
			cin >> index >> val;

			sum = sum + val * index;

			if(index == elements)
				lastElement += val;
			else
				d[index - 1]  -= val;
		}

		// cout << "No. of Elements : " << elements << endl;
		// cout << "Last Element : " << lastElement << endl;
		// cout << "Sum : " << sum << endl;
		// cout << "Elements of D : "  << " ";
		// for(double i = 0; i < d.size(); i ++)
		// 	cout << d[i] << " ";
		// cout << endl;
		double ans = (double)sum / elements;
		cout << fixed << setprecision(6) << ans << endl;
	}

}


#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <climits>
#include <iomanip>
#define endl "\n"
#define ll long long
using namespace std;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	double n;
	cin >> n;
	double sum = 0;
	double elements = 1;
	vector <double> d;
	double lastElement = 0;
	while(n --)
	{
		double type;
		cin >> type;

		if(type == 3 && elements >= 2)
		{
			elements --;
			sum -= lastElement;
			lastElement = lastElement - d[elements - 1];
			d.pop_back();
		}
		else if(type == 2)
		{
			double data;
			cin >> data;
			sum += data;
			elements ++;
			d.push_back(data - lastElement);
			lastElement = data;
		}
		else if(type == 1)
		{
			double index, val;
			cin >> index >> val;

			sum = sum + val * index;

			if(index == elements)
				lastElement += val;
			else
				d[index - 1]  -= val;
		}

		// cout << "No. of Elements : " << elements << endl;
		// cout << "Last Element : " << lastElement << endl;
		// cout << "Sum : " << sum << endl;
		// cout << "Elements of D : "  << " ";
		// for(double i = 0; i < d.size(); i ++)
		// 	cout << d[i] << " ";
		// cout << endl;
		double ans = sum / elements;
		cout << fixed << setprecision(6) << ans << endl;
	}

}


//#include <bits/stdc++.h>
#include<iostream>
#include <iosfwd>
#include<limits.h>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <limits>
#include<stdio.h>
#include <queue>
#include <stack>
#include <math.h>
#include<string.h>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include<vector>
#include <chrono>
#include <random>
using namespace std;
using namespace std::chrono;
#define fr(i,j,n)   for(lli i=j;i<(n);++i)
#define bk(i,j,n)   for(lli i=j;i>=n&&j>=n;--i)
#define pb push_back
#define m_p make_pair
#define Fs first
#define Sc second
#define endl "\n"
#define MOD 1000000007
#define present(c,x)    ((c).find(x) != (c).end())
#define run ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update>
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define mem(p,v) memset(p,(lli)v,sizeof p);
#define ub upper_bound
#define lb lower_bound
typedef long long int lli;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<lli> vl;
typedef pair<lli,lli> pl;
inline lli max(lli a,lli b){ return a>b?a:b;}
inline lli min(lli a,lli b){ return a<b?a:b;}
inline lli max(vl a){return *max_element(a.begin(),a.end());}
inline lli min(vl a){return *min_element(a.begin(),a.end());}
inline lli min(lli a[],lli n){return *min_element(a,a+n);}
inline lli max(lli a[],lli n){return *max_element(a,a+n);}
inline lli sum(lli a[],lli n){return accumulate(a, a+n,0);}
inline lli sum(vl a){return accumulate(a.begin(), a.end(),0);}
const long long inf = 1e18;

lli modpow(lli x,lli n){
    lli res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
lli power(lli x, lli n)
{
    lli res=1;
    while(n>0){
        if(n&1) res=res*x;
        x=x*x;
        n>>=1;
    }
    return res;
}
void show(vector<lli> v)
{
    fr(i,0,v.size())
    cout<<v[i]<<" ";
    cout<<endl;
}
void show(vector<int> v)
{
    fr(i,0,v.size())
    cout<<v[i]<<" ";
    cout<<endl;
}
void show(int a[], int arraysize)
{
    for (int i = 0; i < arraysize; ++i)
        cout << a[i] << " ";
    cout<<endl;
}
void show(lli a[], lli arraysize)
{
    for (lli i = 0; i < arraysize; ++i)
        cout << a[i] << " ";
    cout<<endl;
}
void show(set<lli> s)
{
    for (auto it = s.begin(); it != s.end(); it++)
    {
        cout << *it << " ";
    }
    cout<<endl;
}
void show(map<lli,lli> mp)
{
    for (auto it = mp.begin(); it != mp.end(); it++)
    {
        cout << it->first << " "<<it->second<<endl;
    }
    cout<<endl;
}
bool comp(pair<lli,lli> p1,pair<lli,lli> p2)
{
    return p1.Fs<p2.Fs;
}

int main()
{
    run;
    lli t,n,x,y;
    cin>>t;
    double m=0;
    double c=1;
    vl v;
    v.pb(0);
    lli a[1001];
    fr(i,0,1001)
    {
        a[i]=0;
    }
    while(t)
    {
        cin>>n;
        if(n==2)
        {
            cin>>x;
            v.pb(x);
            m=(m*c+x)/(c+1);
            c+=1;
        }
        else if(n==3)
        {
            m=(m*c-v[c-1]-a[(lli)c-1])/(c-1);
            a[(lli)c-2]+=a[(lli)c-1];
            a[(lli)c-1]=0;
            c-=1;
        }
        else
        {
            cin>>x>>y;
            m=(m*c+x*y)/c;
            a[x-1]+=y;
        }
        cout << fixed << setprecision(12) <<m<<endl;
        t--;
    }

    return 0;
}


//#include <bits/stdc++.h>
#include<iostream>
#include <iosfwd>
#include<limits.h>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <limits>
#include<stdio.h>
#include <queue>
#include <stack>
#include <math.h>
#include<string.h>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include<vector>
#include <chrono>
#include <random>
using namespace std;
using namespace std::chrono;
#define fr(i,j,n)   for(lli i=j;i<(n);++i)
#define bk(i,j,n)   for(lli i=j;i>=n&&j>=n;--i)
#define pb push_back
#define m_p make_pair
#define Fs first
#define Sc second
#define endl "\n"
#define MOD 1000000007
#define present(c,x)    ((c).find(x) != (c).end())
#define run ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update>
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define mem(p,v) memset(p,(lli)v,sizeof p);
#define ub upper_bound
#define lb lower_bound
typedef long long int lli;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<lli> vl;
typedef pair<lli,lli> pl;
inline lli max(lli a,lli b){ return a>b?a:b;}
inline lli min(lli a,lli b){ return a<b?a:b;}
inline lli max(vl a){return *max_element(a.begin(),a.end());}
inline lli min(vl a){return *min_element(a.begin(),a.end());}
inline lli min(lli a[],lli n){return *min_element(a,a+n);}
inline lli max(lli a[],lli n){return *max_element(a,a+n);}
inline lli sum(lli a[],lli n){return accumulate(a, a+n,0);}
inline lli sum(vl a){return accumulate(a.begin(), a.end(),0);}
const long long inf = 1e18;

lli modpow(lli x,lli n){
    lli res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
lli power(lli x, lli n)
{
    lli res=1;
    while(n>0){
        if(n&1) res=res*x;
        x=x*x;
        n>>=1;
    }
    return res;
}
void show(vector<lli> v)
{
    fr(i,0,v.size())
    cout<<v[i]<<" ";
    cout<<endl;
}
void show(vector<int> v)
{
    fr(i,0,v.size())
    cout<<v[i]<<" ";
    cout<<endl;
}
void show(int a[], int arraysize)
{
    for (int i = 0; i < arraysize; ++i)
        cout << a[i] << " ";
    cout<<endl;
}
void show(lli a[], lli arraysize)
{
    for (lli i = 0; i < arraysize; ++i)
        cout << a[i] << " ";
    cout<<endl;
}
void show(set<lli> s)
{
    for (auto it = s.begin(); it != s.end(); it++)
    {
        cout << *it << " ";
    }
    cout<<endl;
}
void show(map<lli,lli> mp)
{
    for (auto it = mp.begin(); it != mp.end(); it++)
    {
        cout << it->first << " "<<it->second<<endl;
    }
    cout<<endl;
}
bool comp(pair<lli,lli> p1,pair<lli,lli> p2)
{
    return p1.Fs<p2.Fs;
}

int main()
{
    run;
    lli t,n,x,y;
    cin>>t;
    double m=0;
    double c=1;
    vl v;
    v.pb(0);
    while(t)
    {
        cin>>n;
        if(n==2)
        {
            cin>>x;
            v.pb(x);
            m=(m*c+x)/(c+1);
            c+=1;
        }
        else if(n==3)
        {
            m=(m*c-v.back())/(c-1);
            c-=1;
            v.erase(v.end()-1);
        }
        else
        {
            cin>>x>>y;
            m=(m*c+x*y)/c;
            fr(i,0,x)
            {
                v[i]+=y;
            }
        }
        cout << fixed << setprecision(12) <<m<<endl;
        t--;
    }

    return 0;
}


//#include <bits/stdc++.h>
#include<iostream>
#include <iosfwd>
#include<limits.h>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <limits>
#include<stdio.h>
#include <queue>
#include <stack>
#include <math.h>
#include<string.h>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include<vector>
#include <chrono>
#include <random>
using namespace std;
using namespace std::chrono;
#define fr(i,j,n)   for(lli i=j;i<(n);++i)
#define bk(i,j,n)   for(lli i=j;i>=n&&j>=n;--i)
#define pb push_back
#define m_p make_pair
#define Fs first
#define Sc second
#define endl "\n"
#define MOD 1000000007
#define present(c,x)    ((c).find(x) != (c).end())
#define run ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update>
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define mem(p,v) memset(p,(lli)v,sizeof p);
#define ub upper_bound
#define lb lower_bound
typedef long long int lli;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<lli> vl;
typedef pair<lli,lli> pl;
inline lli max(lli a,lli b){ return a>b?a:b;}
inline lli min(lli a,lli b){ return a<b?a:b;}
inline lli max(vl a){return *max_element(a.begin(),a.end());}
inline lli min(vl a){return *min_element(a.begin(),a.end());}
inline lli min(lli a[],lli n){return *min_element(a,a+n);}
inline lli max(lli a[],lli n){return *max_element(a,a+n);}
inline lli sum(lli a[],lli n){return accumulate(a, a+n,0);}
inline lli sum(vl a){return accumulate(a.begin(), a.end(),0);}
const long long inf = 1e18;

lli modpow(lli x,lli n){
    lli res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
lli power(lli x, lli n)
{
    lli res=1;
    while(n>0){
        if(n&1) res=res*x;
        x=x*x;
        n>>=1;
    }
    return res;
}
void show(vector<lli> v)
{
    fr(i,0,v.size())
    cout<<v[i]<<" ";
    cout<<endl;
}
void show(vector<int> v)
{
    fr(i,0,v.size())
    cout<<v[i]<<" ";
    cout<<endl;
}
void show(int a[], int arraysize)
{
    for (int i = 0; i < arraysize; ++i)
        cout << a[i] << " ";
    cout<<endl;
}
void show(lli a[], lli arraysize)
{
    for (lli i = 0; i < arraysize; ++i)
        cout << a[i] << " ";
    cout<<endl;
}
void show(set<lli> s)
{
    for (auto it = s.begin(); it != s.end(); it++)
    {
        cout << *it << " ";
    }
    cout<<endl;
}
void show(map<lli,lli> mp)
{
    for (auto it = mp.begin(); it != mp.end(); it++)
    {
        cout << it->first << " "<<it->second<<endl;
    }
    cout<<endl;
}
bool comp(pair<lli,lli> p1,pair<lli,lli> p2)
{
    return p1.Fs<p2.Fs;
}

int main()
{
    run;
    lli t,n,x,y;
    cin>>t;
    double m=0;
    double c=1;
    vl v(200002);
    v[0]=0;
    lli a[200002];
    fr(i,0,200002)
    {
        a[i]=0;
    }
    while(t)
    {
        cin>>n;
        if(n==2)
        {
            cin>>x;
            v[c]=x;
            m=(m*c+x)/(c+1);
            c+=1;
        }
        else if(n==3)
        {
            m=(m*c-v[c-1]-a[(lli)c-1])/(c-1);
            a[(lli)c-2]+=a[(lli)c-1];
            a[(lli)c-1]=0;
            c-=1;
        }
        else
        {
            cin>>x>>y;
            m=(m*c+x*y)/c;
            a[x-1]+=y;
        }
        cout << fixed << setprecision(12) <<m<<endl;
        t--;
    }

    return 0;
}


//#include <bits/stdc++.h>
#include<iostream>
#include <iosfwd>
#include<limits.h>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <limits>
#include<stdio.h>
#include <queue>
#include <stack>
#include <math.h>
#include<string.h>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include<vector>
#include <chrono>
#include <random>
using namespace std;
using namespace std::chrono;
#define fr(i,j,n)   for(lli i=j;i<(n);++i)
#define bk(i,j,n)   for(lli i=j;i>=n&&j>=n;--i)
#define pb push_back
#define m_p make_pair
#define Fs first
#define Sc second
#define endl "\n"
#define MOD 1000000007
#define present(c,x)    ((c).find(x) != (c).end())
#define run ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update>
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define mem(p,v) memset(p,(lli)v,sizeof p);
#define ub upper_bound
#define lb lower_bound
typedef long long int lli;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<lli> vl;
typedef pair<lli,lli> pl;
inline lli max(lli a,lli b){ return a>b?a:b;}
inline lli min(lli a,lli b){ return a<b?a:b;}
inline lli max(vl a){return *max_element(a.begin(),a.end());}
inline lli min(vl a){return *min_element(a.begin(),a.end());}
inline lli min(lli a[],lli n){return *min_element(a,a+n);}
inline lli max(lli a[],lli n){return *max_element(a,a+n);}
inline lli sum(lli a[],lli n){return accumulate(a, a+n,0);}
inline lli sum(vl a){return accumulate(a.begin(), a.end(),0);}
const long long inf = 1e18;

lli modpow(lli x,lli n){
    lli res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
lli power(lli x, lli n)
{
    lli res=1;
    while(n>0){
        if(n&1) res=res*x;
        x=x*x;
        n>>=1;
    }
    return res;
}
void show(vector<lli> v)
{
    fr(i,0,v.size())
    cout<<v[i]<<" ";
    cout<<endl;
}
void show(vector<int> v)
{
    fr(i,0,v.size())
    cout<<v[i]<<" ";
    cout<<endl;
}
void show(int a[], int arraysize)
{
    for (int i = 0; i < arraysize; ++i)
        cout << a[i] << " ";
    cout<<endl;
}
void show(lli a[], lli arraysize)
{
    for (lli i = 0; i < arraysize; ++i)
        cout << a[i] << " ";
    cout<<endl;
}
void show(set<lli> s)
{
    for (auto it = s.begin(); it != s.end(); it++)
    {
        cout << *it << " ";
    }
    cout<<endl;
}
void show(map<lli,lli> mp)
{
    for (auto it = mp.begin(); it != mp.end(); it++)
    {
        cout << it->first << " "<<it->second<<endl;
    }
    cout<<endl;
}
bool comp(pair<lli,lli> p1,pair<lli,lli> p2)
{
    return p1.Fs<p2.Fs;
}

int main()
{
    run;
    lli t,n,x,y;
    cin>>t;
    double m=0;
    double c=1;
    vl v(200001);
    v[0]=0;
    lli a[20000];
    fr(i,0,20000)
    {
        a[i]=0;
    }
    while(t)
    {
        cin>>n;
        if(n==2)
        {
            cin>>x;
            v[c]=x;
            m=(m*c+x)/(c+1);
            c+=1;
        }
        else if(n==3)
        {
            m=(m*c-v[c-1]-a[(lli)c-1])/(c-1);
            a[(lli)c-2]+=a[(lli)c-1];
            a[(lli)c-1]=0;
            c-=1;
        }
        else
        {
            cin>>x>>y;
            m=(m*c+x*y)/c;
            a[x-1]+=y;
        }
        cout << fixed << setprecision(12) <<m<<endl;
        t--;
    }

    return 0;
}


//#include <bits/stdc++.h>
#include<iostream>
#include <iosfwd>
#include<limits.h>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <limits>
#include<stdio.h>
#include <queue>
#include <stack>
#include <math.h>
#include<string.h>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include<vector>
#include <chrono>
#include <random>
using namespace std;
using namespace std::chrono;
#define fr(i,j,n)   for(lli i=j;i<(n);++i)
#define bk(i,j,n)   for(lli i=j;i>=n&&j>=n;--i)
#define pb push_back
#define m_p make_pair
#define Fs first
#define Sc second
#define endl "\n"
#define MOD 1000000007
#define present(c,x)    ((c).find(x) != (c).end())
#define run ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update>
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define mem(p,v) memset(p,(lli)v,sizeof p);
#define ub upper_bound
#define lb lower_bound
typedef long long int lli;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<lli> vl;
typedef pair<lli,lli> pl;
inline lli max(lli a,lli b){ return a>b?a:b;}
inline lli min(lli a,lli b){ return a<b?a:b;}
inline lli max(vl a){return *max_element(a.begin(),a.end());}
inline lli min(vl a){return *min_element(a.begin(),a.end());}
inline lli min(lli a[],lli n){return *min_element(a,a+n);}
inline lli max(lli a[],lli n){return *max_element(a,a+n);}
inline lli sum(lli a[],lli n){return accumulate(a, a+n,0);}
inline lli sum(vl a){return accumulate(a.begin(), a.end(),0);}
const long long inf = 1e18;

lli modpow(lli x,lli n){
    lli res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
lli power(lli x, lli n)
{
    lli res=1;
    while(n>0){
        if(n&1) res=res*x;
        x=x*x;
        n>>=1;
    }
    return res;
}
void show(vector<lli> v)
{
    fr(i,0,v.size())
    cout<<v[i]<<" ";
    cout<<endl;
}
void show(vector<int> v)
{
    fr(i,0,v.size())
    cout<<v[i]<<" ";
    cout<<endl;
}
void show(int a[], int arraysize)
{
    for (int i = 0; i < arraysize; ++i)
        cout << a[i] << " ";
    cout<<endl;
}
void show(lli a[], lli arraysize)
{
    for (lli i = 0; i < arraysize; ++i)
        cout << a[i] << " ";
    cout<<endl;
}
void show(set<lli> s)
{
    for (auto it = s.begin(); it != s.end(); it++)
    {
        cout << *it << " ";
    }
    cout<<endl;
}
void show(map<lli,lli> mp)
{
    for (auto it = mp.begin(); it != mp.end(); it++)
    {
        cout << it->first << " "<<it->second<<endl;
    }
    cout<<endl;
}
bool comp(pair<lli,lli> p1,pair<lli,lli> p2)
{
    return p1.Fs<p2.Fs;
}

int main()
{
    run;
    lli t,n,x,y;
    cin>>t;
    double m=0;
    double c=1;
    vl v(100001);
    v[0]=0;
    lli a[1001];
    fr(i,0,1001)
    {
        a[i]=0;
    }
    while(t)
    {
        cin>>n;
        if(n==2)
        {
            cin>>x;
            v[c]=x;
            m=(m*c+x)/(c+1);
            c+=1;
        }
        else if(n==3)
        {
            m=(m*c-v[c-1]-a[(lli)c-1])/(c-1);
            a[(lli)c-2]+=a[(lli)c-1];
            a[(lli)c-1]=0;
            c-=1;
        }
        else
        {
            cin>>x>>y;
            m=(m*c+x*y)/c;
            a[x-1]+=y;
        }
        cout << fixed << setprecision(12) <<m<<endl;
        t--;
    }

    return 0;
}


//#include <bits/stdc++.h>
#include<iostream>
#include <iosfwd>
#include<limits.h>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <limits>
#include<stdio.h>
#include <queue>
#include <stack>
#include <math.h>
#include<string.h>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include<vector>
#include <chrono>
#include <random>
using namespace std;
using namespace std::chrono;
#define fr(i,j,n)   for(lli i=j;i<(n);++i)
#define bk(i,j,n)   for(lli i=j;i>=n&&j>=n;--i)
#define pb push_back
#define m_p make_pair
#define Fs first
#define Sc second
#define endl "\n"
#define MOD 1000000007
#define present(c,x)    ((c).find(x) != (c).end())
#define run ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update>
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define mem(p,v) memset(p,(lli)v,sizeof p);
#define ub upper_bound
#define lb lower_bound
typedef long long int lli;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<lli> vl;
typedef pair<lli,lli> pl;
inline lli max(lli a,lli b){ return a>b?a:b;}
inline lli min(lli a,lli b){ return a<b?a:b;}
inline lli max(vl a){return *max_element(a.begin(),a.end());}
inline lli min(vl a){return *min_element(a.begin(),a.end());}
inline lli min(lli a[],lli n){return *min_element(a,a+n);}
inline lli max(lli a[],lli n){return *max_element(a,a+n);}
inline lli sum(lli a[],lli n){return accumulate(a, a+n,0);}
inline lli sum(vl a){return accumulate(a.begin(), a.end(),0);}
const long long inf = 1e18;

lli modpow(lli x,lli n){
    lli res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
lli power(lli x, lli n)
{
    lli res=1;
    while(n>0){
        if(n&1) res=res*x;
        x=x*x;
        n>>=1;
    }
    return res;
}
void show(vector<lli> v)
{
    fr(i,0,v.size())
    cout<<v[i]<<" ";
    cout<<endl;
}
void show(vector<int> v)
{
    fr(i,0,v.size())
    cout<<v[i]<<" ";
    cout<<endl;
}
void show(int a[], int arraysize)
{
    for (int i = 0; i < arraysize; ++i)
        cout << a[i] << " ";
    cout<<endl;
}
void show(lli a[], lli arraysize)
{
    for (lli i = 0; i < arraysize; ++i)
        cout << a[i] << " ";
    cout<<endl;
}
void show(set<lli> s)
{
    for (auto it = s.begin(); it != s.end(); it++)
    {
        cout << *it << " ";
    }
    cout<<endl;
}
void show(map<lli,lli> mp)
{
    for (auto it = mp.begin(); it != mp.end(); it++)
    {
        cout << it->first << " "<<it->second<<endl;
    }
    cout<<endl;
}
bool comp(pair<lli,lli> p1,pair<lli,lli> p2)
{
    return p1.Fs<p2.Fs;
}

int main()
{
    run;
    lli t,n,x,y;
    cin>>t;
    double m=0;
    lli c=1;
    vl v(200002);
    v[0]=0;
    lli a[200002];
    fr(i,0,200002)
    {
        a[i]=0;
    }
    while(t)
    {
        cin>>n;
        if(n==2)
        {
            cin>>x;
            v[c]=x;
            m=(double)(m*c+x)/(double)(c+1);
            c+=1;
        }
        else if(n==3)
        {
            m=(m*c-(double)(v[c-1]+a[c-1]))/(double)(c-1);
            a[c-2]+=a[c-1];
            a[c-1]=0;
            c-=1;
        }
        else
        {
            cin>>x>>y;
            m=(m*c+(double)(x*y))/(double)c;
            a[x-1]+=y;
        }
        cout << fixed << setprecision(12) <<m<<endl;
        t--;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define mainspring cout<<"mainspring\n";
#define barrel cout<<"barrel\n";
#define escapement cout<<"escapement\n";

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)((v).size())
#define fs first
#define sd second
#define tik(i,a,b) for(int i = a; i < b; i++)
#define tok(i,a,b) for(int i = a; i >= b; i--)
#define error(args...) {string _s = #args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it,args);}

typedef long long ll;
typedef unsigned long long ull;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " ";
    err(++it, args...);
}

// const int MAX = 1E6 + 100;
#define double long double
#define int ll

// int seg_tree[3*MAX + 10];
// int a[MAX];
// bool par[3*MAX + 10];

// int add(int x, int y) {
// 	return x + y;
// }

// void build_tree(int node, int l, int r) {
// 	if(l == r) {
// 		seg_tree[node] = a[l];
// 		return;
// 	}
// 	int mid = (l + r)/2;
// 	build_tree(2*node + 1, l, mid);
// 	build_tree(2*node + 2, mid + 1, r);
// 	seg_tree[node] = add(seg_tree[2*node + 1], seg_tree[2*node + 2]);
// }

// // int find(int node, int l, int r, int tl, int tr) {
// // 	int mid = (l + r)/2;
// // 	if(tl > tr)
// // 		return 0;
// // 	if(tl == l && tr == r)
// // 		return seg_tree[node];
// // 	return ad(find(2*node + 1, l, mid, tl, min(tr,mid)), find(2*node + 2, mid + 1, r, max(tl,mid + 1), tr));
// // }

// // void modify(int node, int l, int r, int m, int val) {
// // 	if(l == m && r == m) {
// // 		seg_tree[node] = val;
// // 		par[node] = 0;
// // 		return;
// // 	}
// // 	int mid = (l + r)/2;
// // 	if(m > mid)
// // 		modify(2*node + 2, mid + 1, r, m, val);
// // 	else
// // 		modify(2*node + 1, l, mid, m, val);
// // 	par[node] = !par[2*node + 1];
// // 	seg_tree[node] = ad(seg_tree[2*node + 1], seg_tree[2*node + 2]);
// // }

// int find(int node, int l, int r, int t) {
// 	if(l == t && r == t)
// 		return seg_tree[node];
// 	int mid = (l + r)/2;
// 	if(t > mid)
// 		return seg_tree[node] + find(2*node + 2, mid + 1, r, t);
// 	else
// 		return seg_tree[node] + find(2*node + 1, l, mid, t);
// }

// void modify(int node, int l, int r, int tl, int tr, int a) {
// 	if(tl > tr)
// 		return;
// 	if(tl == l && tr == r) {
// 		seg_tree[node] += a;
// 		return;
// 	}
// 	int mid = (l + r)/2;
// 	modify(2*node + 1, l, mid, tl, min(mid,tr), a);
// 	modify(2*node + 2, mid + 1, r, max(mid + 1, tl), tr, a );
// }

const int MAXN = 1E6;
int ad[MAXN];

int32_t main() {
	fast();
	double avg = 0.0;
	int tot = 0;
	int q, cur_size = 1;
	vi v{0};
	cin >> q;
	int n = 1E6;
	for(int i = 0; i < q; i++) {
		int t;
		cin >> t;
		if(t == 1) {
			int a, x;
			cin >> a >> x;
			tot += a*x;
			avg = (1.0*tot)/cur_size;
			ad[a - 1] += x;
		}
		else if(t == 2) {
			int k;
			cin >> k;
			tot += k;
			cur_size++;
			avg = (1.0*tot)/cur_size;
			v.pb(k);
		}
		else {
			int del = ad[cur_size - 1];
			ad[cur_size - 2] += del;
			//modify(0, 0, n - 1, n - 1, cur_size - 1, -del);
			tot -= v.back() + del;
			v.pop_back();
			--cur_size;
			avg  = (1.0*tot)/cur_size;
		}
		cout << fixed << setprecision(15) << avg << '\n';
	}
}


#include <bits/stdc++.h>
using namespace std;

#define mainspring cout<<"mainspring\n";
#define barrel cout<<"barrel\n";
#define escapement cout<<"escapement\n";

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)((v).size())
#define fs first
#define sd second
#define tik(i,a,b) for(int i = a; i < b; i++)
#define tok(i,a,b) for(int i = a; i >= b; i--)
#define error(args...) {string _s = #args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it,args);}

typedef long long ll;
typedef unsigned long long ull;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " ";
    err(++it, args...);
}

const int MAX = 1E6 + 100;
#define double long double
#define int ll

int seg_tree[3*MAX + 10];
int a[MAX];
bool par[3*MAX + 10];

int add(int x, int y) {
	return x + y;
}

void build_tree(int node, int l, int r) {
	if(l == r) {
		seg_tree[node] = a[l];
		return;
	}
	int mid = (l + r)/2;
	build_tree(2*node + 1, l, mid);
	build_tree(2*node + 2, mid + 1, r);
	seg_tree[node] = add(seg_tree[2*node + 1], seg_tree[2*node + 2]);
}

// int find(int node, int l, int r, int tl, int tr) {
// 	int mid = (l + r)/2;
// 	if(tl > tr)
// 		return 0;
// 	if(tl == l && tr == r)
// 		return seg_tree[node];
// 	return add(find(2*node + 1, l, mid, tl, min(tr,mid)), find(2*node + 2, mid + 1, r, max(tl,mid + 1), tr));
// }

// void modify(int node, int l, int r, int m, int val) {
// 	if(l == m && r == m) {
// 		seg_tree[node] = val;
// 		par[node] = 0;
// 		return;
// 	}
// 	int mid = (l + r)/2;
// 	if(m > mid)
// 		modify(2*node + 2, mid + 1, r, m, val);
// 	else
// 		modify(2*node + 1, l, mid, m, val);
// 	par[node] = !par[2*node + 1];
// 	seg_tree[node] = add(seg_tree[2*node + 1], seg_tree[2*node + 2]);
// }

int find(int node, int l, int r, int t) {
	if(l == t && r == t)
		return seg_tree[node];
	int mid = (l + r)/2;
	if(t > mid)
		return seg_tree[node] + find(2*node + 2, mid + 1, r, t);
	else
		return seg_tree[node] + find(2*node + 1, l, mid, t);
}

void modify(int node, int l, int r, int tl, int tr, int a) {
	if(tl > tr)
		return;
	if(tl == l && tr == r) {
		seg_tree[node] += a;
		return;
	}
	int mid = (l + r)/2;
	modify(2*node + 1, l, mid, tl, min(mid,tr), a);
	modify(2*node + 2, mid + 1, r, max(mid + 1, tl), tr, a );
}

int32_t main() {
	fast();
	double avg = 0.0;
	int tot = 0;
	int q, cur_size = 1;
	vi v{0};
	cin >> q;
	int n = 1E6;
	for(int i = 0; i < q; i++) {
		int t;
		cin >> t;
		if(t == 1) {
			double a, x;
			cin >> a >> x;
			tot += a*x;
			avg = (1.0*tot)/cur_size;
			modify(0, 0, n - 1, 0, a - 1, x);
		}
		else if(t == 2) {
			int k;
			cin >> k;
			tot += k;
			cur_size++;
			avg = (1.0*tot)/cur_size;
			v.pb(k);
		}
		else {
			int del = find(0, 0, n - 1, cur_size - 1);
			modify(0, 0, n - 1, n - 1, cur_size - 1, -del);
			tot -= v.back() + del;
			v.pop_back();
			--cur_size;
			avg  = (1.0*tot)/cur_size;
		}
		cout << fixed << setprecision(15) << avg << '\n';
	}
}


#include <bits/stdc++.h>
using namespace std;

#define mainspring cout<<"mainspring\n";
#define barrel cout<<"barrel\n";
#define escapement cout<<"escapement\n";

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)((v).size())
#define fs first
#define sd second
#define tik(i,a,b) for(int i = a; i < b; i++)
#define tok(i,a,b) for(int i = a; i >= b; i--)
#define error(args...) {string _s = #args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it,args);}

typedef long long ll;
typedef unsigned long long ull;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " ";
    err(++it, args...);
}

const int MAX = 1E6 + 100;
#define double long double
#define int ll

int seg_tree[3*MAX + 10];
int a[MAX];
bool par[3*MAX + 10];

int add(int x, int y) {
	return x + y;
}

void build_tree(int node, int l, int r) {
	if(l == r) {
		seg_tree[node] = a[l];
		return;
	}
	int mid = (l + r)/2;
	build_tree(2*node + 1, l, mid);
	build_tree(2*node + 2, mid + 1, r);
	seg_tree[node] = add(seg_tree[2*node + 1], seg_tree[2*node + 2]);
}

// int find(int node, int l, int r, int tl, int tr) {
// 	int mid = (l + r)/2;
// 	if(tl > tr)
// 		return 0;
// 	if(tl == l && tr == r)
// 		return seg_tree[node];
// 	return add(find(2*node + 1, l, mid, tl, min(tr,mid)), find(2*node + 2, mid + 1, r, max(tl,mid + 1), tr));
// }

// void modify(int node, int l, int r, int m, int val) {
// 	if(l == m && r == m) {
// 		seg_tree[node] = val;
// 		par[node] = 0;
// 		return;
// 	}
// 	int mid = (l + r)/2;
// 	if(m > mid)
// 		modify(2*node + 2, mid + 1, r, m, val);
// 	else
// 		modify(2*node + 1, l, mid, m, val);
// 	par[node] = !par[2*node + 1];
// 	seg_tree[node] = add(seg_tree[2*node + 1], seg_tree[2*node + 2]);
// }

int find(int node, int l, int r, int t) {
	if(l == t && r == t)
		return seg_tree[node];
	int mid = (l + r)/2;
	if(t > mid)
		return seg_tree[node] + find(2*node + 2, mid + 1, r, t);
	else
		return seg_tree[node] + find(2*node + 1, l, mid, t);
}

void modify(int node, int l, int r, int tl, int tr, int a) {
	if(tl > tr)
		return;
	if(tl == l && tr == r) {
		seg_tree[node] += a;
		return;
	}
	int mid = (l + r)/2;
	modify(2*node + 1, l, mid, tl, min(mid,tr), a);
	modify(2*node + 2, mid + 1, r, max(mid + 1, tl), tr, a );
}

int32_t main() {
	fast();
	double avg = 0.0;
	int q, cur_size = 1;
	vi v{0};
	cin >> q;
	int n = 1E6;
	for(int i = 0; i < q; i++) {
		int t;
		cin >> t;
		if(t == 1) {
			double a, x;
			cin >> a >> x;
			avg += (1.0*a*x)/(cur_size);
			modify(0, 0, n - 1, 0, a - 1, x);
		}
		else if(t == 2) {
			int k;
			cin >> k;
			avg = (1.0*cur_size*avg) + k;
			cur_size++;
			avg /= 1.0*cur_size;
			v.pb(k);
		}
		else {
			int del = find(0, 0, n - 1, cur_size - 1);
			modify(0, 0, n - 1, n - 1, cur_size - 1, -del);
			avg = (cur_size*avg) - v.back() - del;
			v.pop_back();
			--cur_size;
			avg /= 1.0*cur_size;
		}
		cout << fixed << setprecision(10) << avg << '\n';
	}
}


#include <bits/stdc++.h>
using namespace std;

#define mainspring cout<<"mainspring\n";
#define barrel cout<<"barrel\n";
#define escapement cout<<"escapement\n";

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)((v).size())
#define fs first
#define sd second
#define tik(i,a,b) for(int i = a; i < b; i++)
#define tok(i,a,b) for(int i = a; i >= b; i--)
#define error(args...) {string _s = #args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it,args);}

typedef long long ll;
typedef unsigned long long ull;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " ";
    err(++it, args...);
}

const int MAX = 1E6 + 100;
#define double long double
#define int ll

int seg_tree[3*MAX + 10];
int a[MAX];
bool par[3*MAX + 10];

int add(int x, int y) {
	return x + y;
}

void build_tree(int node, int l, int r) {
	if(l == r) {
		seg_tree[node] = a[l];
		return;
	}
	int mid = (l + r)/2;
	build_tree(2*node + 1, l, mid);
	build_tree(2*node + 2, mid + 1, r);
	seg_tree[node] = add(seg_tree[2*node + 1], seg_tree[2*node + 2]);
}

// int find(int node, int l, int r, int tl, int tr) {
// 	int mid = (l + r)/2;
// 	if(tl > tr)
// 		return 0;
// 	if(tl == l && tr == r)
// 		return seg_tree[node];
// 	return add(find(2*node + 1, l, mid, tl, min(tr,mid)), find(2*node + 2, mid + 1, r, max(tl,mid + 1), tr));
// }

// void modify(int node, int l, int r, int m, int val) {
// 	if(l == m && r == m) {
// 		seg_tree[node] = val;
// 		par[node] = 0;
// 		return;
// 	}
// 	int mid = (l + r)/2;
// 	if(m > mid)
// 		modify(2*node + 2, mid + 1, r, m, val);
// 	else
// 		modify(2*node + 1, l, mid, m, val);
// 	par[node] = !par[2*node + 1];
// 	seg_tree[node] = add(seg_tree[2*node + 1], seg_tree[2*node + 2]);
// }

int find(int node, int l, int r, int t) {
	if(l == t && r == t)
		return seg_tree[node];
	int mid = (l + r)/2;
	if(t > mid)
		return seg_tree[node] + find(2*node + 2, mid + 1, r, t);
	else
		return seg_tree[node] + find(2*node + 1, l, mid, t);
}

void modify(int node, int l, int r, int tl, int tr, int a) {
	if(tl > tr)
		return;
	if(tl == l && tr == r) {
		seg_tree[node] += a;
		return;
	}
	int mid = (l + r)/2;
	modify(2*node + 1, l, mid, tl, min(mid,tr), a);
	modify(2*node + 2, mid + 1, r, max(mid + 1, tl), tr, a );
}

int32_t main() {
	fast();
	double avg = 0.0;
	int q, cur_size = 1;
	vi v{0};
	cin >> q;
	int n = 1E6;
	for(int i = 0; i < q; i++) {
		int t;
		cin >> t;
		if(t == 1) {
			double a, x;
			cin >> a >> x;
			avg += (a*x)/(cur_size);
			modify(0, 0, n - 1, 0, a - 1, x);
		}
		else if(t == 2) {
			int k;
			cin >> k;
			avg = (cur_size*avg) + k;
			cur_size++;
			avg /= cur_size;
			v.pb(k);
		}
		else {
			int del = find(0, 0, n - 1, cur_size - 1);
			modify(0, 0, n - 1, n - 1, cur_size - 1, -del);
			avg = (cur_size*avg) - v.back() - del;
			v.pop_back();
			--cur_size;
			avg /= cur_size;
		}
		cout << fixed << setprecision(10) << avg << '\n';
	}
}


#include <bits/stdc++.h>
using namespace std;

#define mainspring cout<<"mainspring\n";
#define barrel cout<<"barrel\n";
#define escapement cout<<"escapement\n";

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)((v).size())
#define fs first
#define sd second
#define tik(i,a,b) for(int i = a; i < b; i++)
#define tok(i,a,b) for(int i = a; i >= b; i--)
#define error(args...) {string _s = #args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it,args);}

typedef long long ll;
typedef unsigned long long ull;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " ";
    err(++it, args...);
}

// const int MAX = 1E6 + 100;
#define double long double
#define int ll

// int seg_tree[3*MAX + 10];
// int a[MAX];
// bool par[3*MAX + 10];

// int add(int x, int y) {
// 	return x + y;
// }

// void build_tree(int node, int l, int r) {
// 	if(l == r) {
// 		seg_tree[node] = a[l];
// 		return;
// 	}
// 	int mid = (l + r)/2;
// 	build_tree(2*node + 1, l, mid);
// 	build_tree(2*node + 2, mid + 1, r);
// 	seg_tree[node] = add(seg_tree[2*node + 1], seg_tree[2*node + 2]);
// }

// // int find(int node, int l, int r, int tl, int tr) {
// // 	int mid = (l + r)/2;
// // 	if(tl > tr)
// // 		return 0;
// // 	if(tl == l && tr == r)
// // 		return seg_tree[node];
// // 	return ad(find(2*node + 1, l, mid, tl, min(tr,mid)), find(2*node + 2, mid + 1, r, max(tl,mid + 1), tr));
// // }

// // void modify(int node, int l, int r, int m, int val) {
// // 	if(l == m && r == m) {
// // 		seg_tree[node] = val;
// // 		par[node] = 0;
// // 		return;
// // 	}
// // 	int mid = (l + r)/2;
// // 	if(m > mid)
// // 		modify(2*node + 2, mid + 1, r, m, val);
// // 	else
// // 		modify(2*node + 1, l, mid, m, val);
// // 	par[node] = !par[2*node + 1];
// // 	seg_tree[node] = ad(seg_tree[2*node + 1], seg_tree[2*node + 2]);
// // }

// int find(int node, int l, int r, int t) {
// 	if(l == t && r == t)
// 		return seg_tree[node];
// 	int mid = (l + r)/2;
// 	if(t > mid)
// 		return seg_tree[node] + find(2*node + 2, mid + 1, r, t);
// 	else
// 		return seg_tree[node] + find(2*node + 1, l, mid, t);
// }

// void modify(int node, int l, int r, int tl, int tr, int a) {
// 	if(tl > tr)
// 		return;
// 	if(tl == l && tr == r) {
// 		seg_tree[node] += a;
// 		return;
// 	}
// 	int mid = (l + r)/2;
// 	modify(2*node + 1, l, mid, tl, min(mid,tr), a);
// 	modify(2*node + 2, mid + 1, r, max(mid + 1, tl), tr, a );
// }

const int MAXN = 1E6;
int ad[MAXN];

int32_t main() {
	fast();
	double avg = 0.0;
	double tot = 0;
	int q, cur_size = 1;
	vi v{0};
	cin >> q;
	int n = 1E6;
	for(int i = 0; i < q; i++) {
		int t;
		cin >> t;
		if(t == 1) {
			int a, x;
			cin >> a >> x;
			tot += (double)a*(double)x;
			avg = (1.0*tot)/(double)cur_size;
			ad[a - 1] += x;
		}
		else if(t == 2) {
			int k;
			cin >> k;
			tot += (double)k;
			cur_size++;
			avg = (1.0*tot)/(double)cur_size;
			v.pb(k);
		}
		else {
			int del = ad[cur_size - 1];
			ad[cur_size - 2] += del;
			//modify(0, 0, n - 1, n - 1, cur_size - 1, -del);
			tot -= 1.0*v.back() + 1.0*del;
			v.pop_back();
			--cur_size;
			avg  = (1.0*tot)/(double)cur_size;
		}
		cout << fixed << setprecision(15) << avg << '\n';
	}
}


#include <bits/stdc++.h>
using namespace std;

#define mainspring cout<<"mainspring\n";
#define barrel cout<<"barrel\n";
#define escapement cout<<"escapement\n";

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)((v).size())
#define fs first
#define sd second
#define tik(i,a,b) for(int i = a; i < b; i++)
#define tok(i,a,b) for(int i = a; i >= b; i--)
#define error(args...) {string _s = #args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it,args);}

typedef long long ll;
typedef unsigned long long ull;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " ";
    err(++it, args...);
}

const int MAX = 1E6 + 100;

int seg_tree[3*MAX + 10];
int a[MAX];
bool par[3*MAX + 10];

int add(int x, int y) {
	return x + y;
}

void build_tree(int node, int l, int r) {
	if(l == r) {
		seg_tree[node] = a[l];
		return;
	}
	int mid = (l + r)/2;
	build_tree(2*node + 1, l, mid);
	build_tree(2*node + 2, mid + 1, r);
	seg_tree[node] = add(seg_tree[2*node + 1], seg_tree[2*node + 2]);
}

// int find(int node, int l, int r, int tl, int tr) {
// 	int mid = (l + r)/2;
// 	if(tl > tr)
// 		return 0;
// 	if(tl == l && tr == r)
// 		return seg_tree[node];
// 	return add(find(2*node + 1, l, mid, tl, min(tr,mid)), find(2*node + 2, mid + 1, r, max(tl,mid + 1), tr));
// }

// void modify(int node, int l, int r, int m, int val) {
// 	if(l == m && r == m) {
// 		seg_tree[node] = val;
// 		par[node] = 0;
// 		return;
// 	}
// 	int mid = (l + r)/2;
// 	if(m > mid)
// 		modify(2*node + 2, mid + 1, r, m, val);
// 	else
// 		modify(2*node + 1, l, mid, m, val);
// 	par[node] = !par[2*node + 1];
// 	seg_tree[node] = add(seg_tree[2*node + 1], seg_tree[2*node + 2]);
// }

int find(int node, int l, int r, int t) {
	if(l == t && r == t)
		return seg_tree[node];
	int mid = (l + r)/2;
	if(t > mid)
		return seg_tree[node] + find(2*node + 2, mid + 1, r, t);
	else
		return seg_tree[node] + find(2*node + 1, l, mid, t);
}

void modify(int node, int l, int r, int tl, int tr, int a) {
	if(tl > tr)
		return;
	if(tl == l && tr == r) {
		seg_tree[node] += a;
		return;
	}
	int mid = (l + r)/2;
	modify(2*node + 1, l, mid, tl, min(mid,tr), a);
	modify(2*node + 2, mid + 1, r, max(mid + 1, tl), tr, a );
}

int main() {
	fast();
	double avg = 0.0;
	int q, cur_size = 1;
	vi v{0};
	cin >> q;
	int n = 1E6;
	for(int i = 0; i < q; i++) {
		int t;
		cin >> t;
		if(t == 1) {
			double a, x;
			cin >> a >> x;
			avg += (a*x)/(cur_size);
			modify(0, 0, n - 1, 0, a - 1, x);
		}
		else if(t == 2) {
			int k;
			cin >> k;
			avg = (cur_size*avg) + k;
			cur_size++;
			avg /= cur_size;
			v.pb(k);
		}
		else {
			int del = find(0, 0, n - 1, cur_size - 1);
			modify(0, 0, n - 1, n - 1, cur_size - 1, -del);
			avg = (cur_size*avg) - v.back() - del;
			v.pop_back();
			--cur_size;
			avg /= cur_size;
		}
		cout << fixed << setprecision(10) << avg << '\n';
	}
}


#include <bits/stdc++.h>
using namespace std;

#define mainspring cout<<"mainspring\n";
#define barrel cout<<"barrel\n";
#define escapement cout<<"escapement\n";

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)((v).size())
#define fs first
#define sd second
#define tik(i,a,b) for(int i = a; i < b; i++)
#define tok(i,a,b) for(int i = a; i >= b; i--)
#define error(args...) {string _s = #args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it,args);}

typedef long long ll;
typedef unsigned long long ull;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " ";
    err(++it, args...);
}

// const int MAX = 1E6 + 100;
//#define double long double
#define int ll

// int seg_tree[3*MAX + 10];
// int a[MAX];
// bool par[3*MAX + 10];

// int add(int x, int y) {
// 	return x + y;
// }

// void build_tree(int node, int l, int r) {
// 	if(l == r) {
// 		seg_tree[node] = a[l];
// 		return;
// 	}
// 	int mid = (l + r)/2;
// 	build_tree(2*node + 1, l, mid);
// 	build_tree(2*node + 2, mid + 1, r);
// 	seg_tree[node] = add(seg_tree[2*node + 1], seg_tree[2*node + 2]);
// }

// // int find(int node, int l, int r, int tl, int tr) {
// // 	int mid = (l + r)/2;
// // 	if(tl > tr)
// // 		return 0;
// // 	if(tl == l && tr == r)
// // 		return seg_tree[node];
// // 	return ad(find(2*node + 1, l, mid, tl, min(tr,mid)), find(2*node + 2, mid + 1, r, max(tl,mid + 1), tr));
// // }

// // void modify(int node, int l, int r, int m, int val) {
// // 	if(l == m && r == m) {
// // 		seg_tree[node] = val;
// // 		par[node] = 0;
// // 		return;
// // 	}
// // 	int mid = (l + r)/2;
// // 	if(m > mid)
// // 		modify(2*node + 2, mid + 1, r, m, val);
// // 	else
// // 		modify(2*node + 1, l, mid, m, val);
// // 	par[node] = !par[2*node + 1];
// // 	seg_tree[node] = ad(seg_tree[2*node + 1], seg_tree[2*node + 2]);
// // }

// int find(int node, int l, int r, int t) {
// 	if(l == t && r == t)
// 		return seg_tree[node];
// 	int mid = (l + r)/2;
// 	if(t > mid)
// 		return seg_tree[node] + find(2*node + 2, mid + 1, r, t);
// 	else
// 		return seg_tree[node] + find(2*node + 1, l, mid, t);
// }

// void modify(int node, int l, int r, int tl, int tr, int a) {
// 	if(tl > tr)
// 		return;
// 	if(tl == l && tr == r) {
// 		seg_tree[node] += a;
// 		return;
// 	}
// 	int mid = (l + r)/2;
// 	modify(2*node + 1, l, mid, tl, min(mid,tr), a);
// 	modify(2*node + 2, mid + 1, r, max(mid + 1, tl), tr, a );
// }

const int MAXN = 1E6;
int ad[MAXN];

int32_t main() {
	fast();
	double avg = 0.0;
	double tot = 0;
	int q, cur_size = 1;
	vi v{0};
	cin >> q;
	int n = 1E6;
	for(int i = 0; i < q; i++) {
		int t;
		cin >> t;
		if(t == 1) {
			int a, x;
			cin >> a >> x;
			tot += (double)a*(double)x;
			avg = (1.0*tot)/(double)cur_size;
			ad[a - 1] += x;
		}
		else if(t == 2) {
			int k;
			cin >> k;
			tot += (double)k;
			cur_size++;
			avg = (1.0*tot)/(double)cur_size;
			v.pb(k);
		}
		else {
			int del = ad[cur_size - 1];
			ad[cur_size - 1] = 0;
			ad[cur_size - 2] += del;
			//modify(0, 0, n - 1, n - 1, cur_size - 1, -del);
			tot -= 1.0*v.back() + 1.0*del;
			v.pop_back();
			--cur_size;
			avg  = (1.0*tot)/(double)cur_size;
		}
		cout << fixed << setprecision(15) << avg << '\n';
	}
}


#include <bits/stdc++.h>
using namespace std;

#define mainspring cout<<"mainspring\n";
#define barrel cout<<"barrel\n";
#define escapement cout<<"escapement\n";

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)((v).size())
#define fs first
#define sd second
#define tik(i,a,b) for(int i = a; i < b; i++)
#define tok(i,a,b) for(int i = a; i >= b; i--)
#define error(args...) {string _s = #args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it,args);}

typedef long long ll;
typedef unsigned long long ull;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " ";
    err(++it, args...);
}

const int MAX = 1E6 + 100;
#define double long double
#define int ll

int seg_tree[3*MAX + 10];
int a[MAX];
bool par[3*MAX + 10];

int add(int x, int y) {
	return x + y;
}

void build_tree(int node, int l, int r) {
	if(l == r) {
		seg_tree[node] = a[l];
		return;
	}
	int mid = (l + r)/2;
	build_tree(2*node + 1, l, mid);
	build_tree(2*node + 2, mid + 1, r);
	seg_tree[node] = add(seg_tree[2*node + 1], seg_tree[2*node + 2]);
}

// int find(int node, int l, int r, int tl, int tr) {
// 	int mid = (l + r)/2;
// 	if(tl > tr)
// 		return 0;
// 	if(tl == l && tr == r)
// 		return seg_tree[node];
// 	return add(find(2*node + 1, l, mid, tl, min(tr,mid)), find(2*node + 2, mid + 1, r, max(tl,mid + 1), tr));
// }

// void modify(int node, int l, int r, int m, int val) {
// 	if(l == m && r == m) {
// 		seg_tree[node] = val;
// 		par[node] = 0;
// 		return;
// 	}
// 	int mid = (l + r)/2;
// 	if(m > mid)
// 		modify(2*node + 2, mid + 1, r, m, val);
// 	else
// 		modify(2*node + 1, l, mid, m, val);
// 	par[node] = !par[2*node + 1];
// 	seg_tree[node] = add(seg_tree[2*node + 1], seg_tree[2*node + 2]);
// }

int find(int node, int l, int r, int t) {
	if(l == t && r == t)
		return seg_tree[node];
	int mid = (l + r)/2;
	if(t > mid)
		return seg_tree[node] + find(2*node + 2, mid + 1, r, t);
	else
		return seg_tree[node] + find(2*node + 1, l, mid, t);
}

void modify(int node, int l, int r, int tl, int tr, int a) {
	if(tl > tr)
		return;
	if(tl == l && tr == r) {
		seg_tree[node] += a;
		return;
	}
	int mid = (l + r)/2;
	modify(2*node + 1, l, mid, tl, min(mid,tr), a);
	modify(2*node + 2, mid + 1, r, max(mid + 1, tl), tr, a );
}

int32_t main() {
	fast();
	double avg = 0.0;
	int q, cur_size = 1;
	vi v{0};
	cin >> q;
	int n = 1E6;
	for(int i = 0; i < q; i++) {
		int t;
		cin >> t;
		if(t == 1) {
			double a, x;
			cin >> a >> x;
			avg += (1.0*a*x)/(cur_size);
			modify(0, 0, n - 1, 0, a - 1, x);
		}
		else if(t == 2) {
			int k;
			cin >> k;
			avg = (1.0*cur_size*avg) + k;
			cur_size++;
			avg /= 1.0*cur_size;
			v.pb(k);
		}
		else {
			int del = find(0, 0, n - 1, cur_size - 1);
			modify(0, 0, n - 1, n - 1, cur_size - 1, -del);
			avg = (cur_size*avg) - v.back() - del;
			v.pop_back();
			--cur_size;
			avg /= 1.0*cur_size;
		}
		cout << fixed << setprecision(15) << avg << '\n';
	}
}


#include <bits/stdc++.h>
using namespace std;

#define mainspring cout<<"mainspring\n";
#define barrel cout<<"barrel\n";
#define escapement cout<<"escapement\n";

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)((v).size())
#define fs first
#define sd second
#define tik(i,a,b) for(int i = a; i < b; i++)
#define tok(i,a,b) for(int i = a; i >= b; i--)
#define error(args...) {string _s = #args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it,args);}

typedef long long ll;
typedef unsigned long long ull;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " ";
    err(++it, args...);
}

// const int MAX = 1E6 + 100;
#define double long double
#define int ll

// int seg_tree[3*MAX + 10];
// int a[MAX];
// bool par[3*MAX + 10];

// int add(int x, int y) {
// 	return x + y;
// }

// void build_tree(int node, int l, int r) {
// 	if(l == r) {
// 		seg_tree[node] = a[l];
// 		return;
// 	}
// 	int mid = (l + r)/2;
// 	build_tree(2*node + 1, l, mid);
// 	build_tree(2*node + 2, mid + 1, r);
// 	seg_tree[node] = add(seg_tree[2*node + 1], seg_tree[2*node + 2]);
// }

// // int find(int node, int l, int r, int tl, int tr) {
// // 	int mid = (l + r)/2;
// // 	if(tl > tr)
// // 		return 0;
// // 	if(tl == l && tr == r)
// // 		return seg_tree[node];
// // 	return ad(find(2*node + 1, l, mid, tl, min(tr,mid)), find(2*node + 2, mid + 1, r, max(tl,mid + 1), tr));
// // }

// // void modify(int node, int l, int r, int m, int val) {
// // 	if(l == m && r == m) {
// // 		seg_tree[node] = val;
// // 		par[node] = 0;
// // 		return;
// // 	}
// // 	int mid = (l + r)/2;
// // 	if(m > mid)
// // 		modify(2*node + 2, mid + 1, r, m, val);
// // 	else
// // 		modify(2*node + 1, l, mid, m, val);
// // 	par[node] = !par[2*node + 1];
// // 	seg_tree[node] = ad(seg_tree[2*node + 1], seg_tree[2*node + 2]);
// // }

// int find(int node, int l, int r, int t) {
// 	if(l == t && r == t)
// 		return seg_tree[node];
// 	int mid = (l + r)/2;
// 	if(t > mid)
// 		return seg_tree[node] + find(2*node + 2, mid + 1, r, t);
// 	else
// 		return seg_tree[node] + find(2*node + 1, l, mid, t);
// }

// void modify(int node, int l, int r, int tl, int tr, int a) {
// 	if(tl > tr)
// 		return;
// 	if(tl == l && tr == r) {
// 		seg_tree[node] += a;
// 		return;
// 	}
// 	int mid = (l + r)/2;
// 	modify(2*node + 1, l, mid, tl, min(mid,tr), a);
// 	modify(2*node + 2, mid + 1, r, max(mid + 1, tl), tr, a );
// }

const int MAXN = 1E6;
int ad[MAXN];

int32_t main() {
	fast();
	double avg = 0.0;
	double tot = 0;
	int q, cur_size = 1;
	vi v{0};
	cin >> q;
	int n = 1E6;
	for(int i = 0; i < q; i++) {
		int t;
		cin >> t;
		if(t == 1) {
			int a, x;
			cin >> a >> x;
			tot += 1.0*a*x;
			avg = (1.0*tot)/cur_size;
			ad[a - 1] += x;
		}
		else if(t == 2) {
			int k;
			cin >> k;
			tot += 1.0*k;
			cur_size++;
			avg = (1.0*tot)/cur_size;
			v.pb(k);
		}
		else {
			int del = ad[cur_size - 1];
			ad[cur_size - 2] += del;
			//modify(0, 0, n - 1, n - 1, cur_size - 1, -del);
			tot -= 1.0*v.back() + 1.0*del;
			v.pop_back();
			--cur_size;
			avg  = (1.0*tot)/cur_size;
		}
		cout << fixed << setprecision(15) << avg << '\n';
	}
}


#include <bits/stdc++.h>
using namespace std;

#define mainspring cout<<"mainspring\n";
#define barrel cout<<"barrel\n";
#define escapement cout<<"escapement\n";

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)((v).size())
#define fs first
#define sd second
#define tik(i,a,b) for(int i = a; i < b; i++)
#define tok(i,a,b) for(int i = a; i >= b; i--)
#define error(args...) {string _s = #args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it,args);}

typedef long long ll;
typedef unsigned long long ull;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " ";
    err(++it, args...);
}

// const int MAX = 1E6 + 100;
//#define double long double
#define int ll

// int seg_tree[3*MAX + 10];
// int a[MAX];
// bool par[3*MAX + 10];

// int add(int x, int y) {
// 	return x + y;
// }

// void build_tree(int node, int l, int r) {
// 	if(l == r) {
// 		seg_tree[node] = a[l];
// 		return;
// 	}
// 	int mid = (l + r)/2;
// 	build_tree(2*node + 1, l, mid);
// 	build_tree(2*node + 2, mid + 1, r);
// 	seg_tree[node] = add(seg_tree[2*node + 1], seg_tree[2*node + 2]);
// }

// // int find(int node, int l, int r, int tl, int tr) {
// // 	int mid = (l + r)/2;
// // 	if(tl > tr)
// // 		return 0;
// // 	if(tl == l && tr == r)
// // 		return seg_tree[node];
// // 	return ad(find(2*node + 1, l, mid, tl, min(tr,mid)), find(2*node + 2, mid + 1, r, max(tl,mid + 1), tr));
// // }

// // void modify(int node, int l, int r, int m, int val) {
// // 	if(l == m && r == m) {
// // 		seg_tree[node] = val;
// // 		par[node] = 0;
// // 		return;
// // 	}
// // 	int mid = (l + r)/2;
// // 	if(m > mid)
// // 		modify(2*node + 2, mid + 1, r, m, val);
// // 	else
// // 		modify(2*node + 1, l, mid, m, val);
// // 	par[node] = !par[2*node + 1];
// // 	seg_tree[node] = ad(seg_tree[2*node + 1], seg_tree[2*node + 2]);
// // }

// int find(int node, int l, int r, int t) {
// 	if(l == t && r == t)
// 		return seg_tree[node];
// 	int mid = (l + r)/2;
// 	if(t > mid)
// 		return seg_tree[node] + find(2*node + 2, mid + 1, r, t);
// 	else
// 		return seg_tree[node] + find(2*node + 1, l, mid, t);
// }

// void modify(int node, int l, int r, int tl, int tr, int a) {
// 	if(tl > tr)
// 		return;
// 	if(tl == l && tr == r) {
// 		seg_tree[node] += a;
// 		return;
// 	}
// 	int mid = (l + r)/2;
// 	modify(2*node + 1, l, mid, tl, min(mid,tr), a);
// 	modify(2*node + 2, mid + 1, r, max(mid + 1, tl), tr, a );
// }

const int MAXN = 1E6;
int ad[MAXN];

int32_t main() {
	fast();
	double avg = 0.0;
	double tot = 0;
	int q, cur_size = 1;
	vi v{0};
	cin >> q;
	int n = 1E6;
	for(int i = 0; i < q; i++) {
		int t;
		cin >> t;
		if(t == 1) {
			int a, x;
			cin >> a >> x;
			tot += (double)a*(double)x;
			avg = (1.0*tot)/(double)cur_size;
			ad[a - 1] += x;
		}
		else if(t == 2) {
			int k;
			cin >> k;
			tot += (double)k;
			cur_size++;
			avg = (1.0*tot)/(double)cur_size;
			v.pb(k);
		}
		else {
			int del = ad[cur_size - 1];
			ad[cur_size - 2] += del;
			//modify(0, 0, n - 1, n - 1, cur_size - 1, -del);
			tot -= 1.0*v.back() + 1.0*del;
			v.pop_back();
			--cur_size;
			avg  = (1.0*tot)/(double)cur_size;
		}
		cout << fixed << setprecision(15) << avg << '\n';
	}
}


#include <bits/stdc++.h>
using namespace std;

#define mainspring cout<<"mainspring\n";
#define barrel cout<<"barrel\n";
#define escapement cout<<"escapement\n";

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)((v).size())
#define fs first
#define sd second
#define tik(i,a,b) for(int i = a; i < b; i++)
#define tok(i,a,b) for(int i = a; i >= b; i--)
#define error(args...) {string _s = #args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it,args);}

typedef long long ll;
typedef unsigned long long ull;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " ";
    err(++it, args...);
}

const int MAX = 1E6 + 100;

int seg_tree[3*MAX + 10];
int a[MAX];
bool par[3*MAX + 10];

int add(int x, int y) {
	return x + y;
}

void build_tree(int node, int l, int r) {
	if(l == r) {
		seg_tree[node] = a[l];
		return;
	}
	int mid = (l + r)/2;
	build_tree(2*node + 1, l, mid);
	build_tree(2*node + 2, mid + 1, r);
	seg_tree[node] = add(seg_tree[2*node + 1], seg_tree[2*node + 2]);
}

// int find(int node, int l, int r, int tl, int tr) {
// 	int mid = (l + r)/2;
// 	if(tl > tr)
// 		return 0;
// 	if(tl == l && tr == r)
// 		return seg_tree[node];
// 	return add(find(2*node + 1, l, mid, tl, min(tr,mid)), find(2*node + 2, mid + 1, r, max(tl,mid + 1), tr));
// }

// void modify(int node, int l, int r, int m, int val) {
// 	if(l == m && r == m) {
// 		seg_tree[node] = val;
// 		par[node] = 0;
// 		return;
// 	}
// 	int mid = (l + r)/2;
// 	if(m > mid)
// 		modify(2*node + 2, mid + 1, r, m, val);
// 	else
// 		modify(2*node + 1, l, mid, m, val);
// 	par[node] = !par[2*node + 1];
// 	seg_tree[node] = add(seg_tree[2*node + 1], seg_tree[2*node + 2]);
// }

int find(int node, int l, int r, int t) {
	if(l == t && r == t)
		return seg_tree[node];
	int mid = (l + r)/2;
	if(t > mid)
		return seg_tree[node] + find(2*node + 2, mid + 1, r, t);
	else
		return seg_tree[node] + find(2*node + 1, l, mid, t);
}

void modify(int node, int l, int r, int tl, int tr, int a) {
	if(tl > tr)
		return;
	if(tl == l && tr == r) {
		seg_tree[node] += a;
		return;
	}
	int mid = (l + r)/2;
	modify(2*node + 1, l, mid, tl, min(mid,tr), a);
	modify(2*node + 2, mid + 1, r, max(mid + 1, tl), tr, a );
}

int main() {
	double avg = 0.0;
	int q, cur_size = 1;
	vi v{0};
	cin >> q;
	int n = 1E6;
	for(int i = 0; i < q; i++) {
		int t;
		cin >> t;
		if(t == 1) {
			double a, x;
			cin >> a >> x;
			avg += (a*x)/(cur_size);
			modify(0, 0, n - 1, 0, a - 1, x);
		}
		else if(t == 2) {
			int k;
			cin >> k;
			avg = (cur_size*avg) + k;
			cur_size++;
			avg /= cur_size;
			v.pb(k);
		}
		else {
			int del = find(0, 0, n - 1, cur_size - 1);
			modify(0, 0, n - 1, n - 1, cur_size - 1, -del);
			avg = (cur_size*avg) - v.back() - del;
			v.pop_back();
			--cur_size;
			avg /= cur_size;
		}
		cout << fixed << setprecision(10) << avg << '\n';
	}
}


#include <bits/stdc++.h>

using namespace std;

void io (){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int main()
{
    io();
    int n,a,b,c,sum=0;
    cin >> n;
    vector<pair<int,int>> v;
    v.push_back({0, 0});
    for (int i = 0; i < n;i++){
        cin >> a;
         if(a==3 && v.size()>=2){
             sum -= (v.back().first + v.back().second);
             int r = v.back().second;
             v.pop_back();
             v.back().second += r;
             cout << fixed << setprecision(6) << ((double)(sum) / (double)(v.size()))<<'\n';
         }
         else if (a==3  && v.size()==1){
             cout << fixed << setprecision(6) << (double)(v.back().first+v.back().second)<<'\n';
         }
         else if (a==2){
             cin>>b;
             sum+=b;
             v.push_back({b, 0});
             cout << fixed << setprecision(6) << ((double)(sum) / (double)(v.size()))<<'\n';
         }
         else if (a==1){
             cin >> b >> c;
             v[b - 1].second += c;
             sum += (b * c);
             cout << fixed << setprecision(6) << ((double)(sum) / (double)(v.size()))<<'\n';
         }

    }
}


#include <bits/stdc++.h>

using namespace std;

void io (){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int main()
{
    io();
    signed long long n,a,b,c,sum=0;
    cin >> n;
    vector<pair<signed long long,signed long long>> v;
    v.push_back({0, 0});
    for (signed long long i = 0; i < n;i++){
        cin >> a;
         if(a==3 && v.size()>=2){
             sum -= (v.back().first + v.back().second);
             signed long long r = v.back().second;
             v.pop_back();
             v.back().second += r;
             cout << fixed << setprecision(6) << ((double)(sum) / (double)(v.size()))<<'\n';
         }
         else if (a==3  && v.size()==1){
             cout << fixed << setprecision(6) << (double)(v.back().first+v.back().second)<<'\n';
         }
         else if (a==2){
             cin>>b;
             sum+=b;
             v.push_back({b, 0});
             cout << fixed << setprecision(6) << ((double)(sum) / (double)(v.size()))<<'\n';
         }
         else if (a==1){
             cin >> b >> c;
             v[b - 1].second += c;
             sum += (b * c);
             cout << fixed << setprecision(6) << ((double)(sum) / (double)(v.size()))<<'\n';
         }

    }
}


#include <bits/stdc++.h>

using namespace std;

void io (){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int main()
{
    io();
    signed long long n1,a,b,c,sum=0;
    cin >> n1;
    vector<pair<signed long long,signed long long>> v;
    v.push_back({0, 0});
    for (signed long long i = 0; i < n1;i++){
        cin >> a;
         if(a==3 && v.size()>=2){
             sum -= (v.back().first + v.back().second);
             signed long long r = v.back().second;
             v.pop_back();
             v.back().second += r;
             cout << fixed << setprecision(6) << ((double)(sum) / (double)(v.size()))<<'\n';
         }
         else if (a==3  && v.size()==1){
             cout << fixed << setprecision(6) << (double)(v.back().first+v.back().second)<<'\n';
         }
         else if (a==2){
             cin>>b;
             sum+=b;
             v.push_back({b, 0});
             cout << fixed << setprecision(6) << ((double)(sum) / (double)(v.size()))<<'\n';
         }
         else if (a==1){
             cin >> b >> c;
             v[b - 1].second += c;
             sum += (b * c);
             cout << fixed << setprecision(6) << ((double)(sum) / (double)(v.size()))<<'\n';
         }

    }
}


#include <bits/stdc++.h>

using namespace std;

void io (){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int main()
{
    io();
    int n,a,b,c,sum=0;
    cin >> n;
    vector <int> v;
    unordered_map<int, int> f;
    v.push_back(0);
    for (int i = 0; i < n;i++){
          cin>>a;
          if(a == 3 && v.size() >=2 ){
               if(f[v.size()-1] != 0){
                   v.back() += f[v.size() - 1];
                   f[v.size() - 2] += f[v.size() - 1];
               }
              sum -= v.back();
              v.pop_back();
              cout <<fixed << setprecision(6) << ((double)sum / (double)v.size())<<'\n';
          }
          else if (a == 3 && v.size() < 2){
              if(f[0] != 0 ){
                  cout << fixed << setprecision(6) << (double)(v.front() + f[0]);
              }
              else{
                  cout << fixed << setprecision(6) << (double)(v.front());
              }
          }
              else if (a == 2)
              {
                  cin >> b;
                  v.push_back(b);
                  sum += b;
                  cout << fixed << setprecision(6) << ((double)sum / (double)v.size()) << '\n';
              }
          else{
              cin >> b >> c;
              f[b - 1] += c;
              sum += (b * c);
              cout << fixed << setprecision(6) << ((double)sum / (double)v.size())<<'\n';
          }
    }
}


#include <bits/stdc++.h>

using namespace std;

void io (){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int main()
{
    io();
    signed long long n,a,b,c,sum=0;
    cin >> n;
    vector<pair<signed long long,signed long long>> v;
    v.push_back({0, 0});
    for (signed long long i = 0; i < n;i++){
        cin >> a;
         if(a==3 && v.size()>=2){
             sum -= (v.back().first + v.back().second);
             signed long long r = v.back().second;
             v.pop_back();
             v.back().second += r;
             cout << fixed << setprecision(6) << ((double)(sum) / (double)(v.size()))<<'\n';
         }
         else if (a==3  && v.size()==1){
             cout << fixed << setprecision(6) << (double)(v.back().first+v.back().second)<<'\n';
         }
         else if (a==2){
             cin>>b;
             sum+=b;
             v.push_back({b, 0});
             cout << fixed << setprecision(6) << ((double)(sum) / (double)(v.size()))<<'\n';
         }
         else if (a==1){
             cin >> b >> c;
             v[b - 1].second += c;
             sum += (b * c);
             cout << fixed << setprecision(6) << ((double)(sum) / (double)(v.size()))<<'\n';
         }

    }
}


// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mp make_pair
#define pi pair<int,int>
#define pl pair<long long int,long long int>
#define pb push_back
#define fi first
#define se second
#define sz(a) (int)(a).size()

typedef long long int ll;
typedef long double ld;

using namespace std;

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

// order_of_key (k) : Number of items strictly smaller than k, basically 0-based index of k
// find_by_order(k) : K-th element in a set (counting from zero)

int d[200005], v[200005];

int main() {
  fastio;
  int n, s = 0, p = 1;
  cin >> n;
  for (int i=0; i<n; ++i) {
    int t;
    cin >> t;
    if (t == 1)  {
      int a, x;
      cin >> a >> x;
      s += x * a;
      d[a] += x;
    }
    if (t == 2) {
      int k;
      cin >> k;
      s += k;
      p++;
      v[p] = k;
    }
    if (t == 3) {
      s -= v[p] + d[p];
      d[p - 1] += d[p];
      p--;
    }
    cout << setprecision(15) << (ld) s / (ld) p << "\n";
  }
  return 0;
}


// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mp make_pair
#define pi pair<int,int>
#define pl pair<long long int,long long int>
#define pb push_back
#define fi first
#define se second
#define sz(a) (int)(a).size()

typedef long long int ll;
typedef long double ld;

using namespace std;

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

// order_of_key (k) : Number of items strictly smaller than k, basically 0-based index of k
// find_by_order(k) : K-th element in a set (counting from zero)

ll d[200005], v[200005];

int main() {
  fastio;
  ll n, s = 0, p = 1;
  cin >> n;
  for (int i=0; i<n; ++i) {
    int t;
    cin >> t;
    if (t == 1)  {
      ll a, x;
      cin >> a >> x;
      assert(a <= p);
      s += x * a;
      d[a] += x;
    }
    if (t == 2) {
      ll k;
      cin >> k;
      s += k;
      p++;
      v[p] = k;
    }
    if (t == 3) {
      s -= v[p] + d[p];
      d[p - 1] += d[p];
      d[p] = 0;
      p--;
    }
    cout << setprecision(15) << (ld) s / (ld) p << "\n";
  }
  return 0;
}


// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mp make_pair
#define pi pair<int,int>
#define pl pair<long long int,long long int>
#define pb push_back
#define fi first
#define se second
#define sz(a) (int)(a).size()

typedef long long int ll;
typedef long double ld;

using namespace std;

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

// order_of_key (k) : Number of items strictly smaller than k, basically 0-based index of k
// find_by_order(k) : K-th element in a set (counting from zero)

int d[200005], v[200005];

int main() {
  fastio;
  int n, s = 0, p = 1;
  cin >> n;
  for (int i=0; i<n; ++i) {
    int t;
    cin >> t;
    if (t == 1)  {
      int a, x;
      cin >> a >> x;
      assert(a <= p);
      s += x * a;
      d[a] += x;
    }
    if (t == 2) {
      int k;
      cin >> k;
      s += k;
      p++;
      v[p] = k;
    }
    if (t == 3) {
      s -= v[p] + d[p];
      d[p - 1] += d[p];
      d[p] = 0;
      p--;
    }
    cout << setprecision(15) << (ld) s / (ld) p << "\n";
  }
  return 0;
}


// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mp make_pair
#define pi pair<int,int>
#define pl pair<long long int,long long int>
#define pb push_back
#define fi first
#define se second
#define sz(a) (int)(a).size()

typedef long long int ll;
typedef long double ld;

using namespace std;

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

// order_of_key (k) : Number of items strictly smaller than k, basically 0-based index of k
// find_by_order(k) : K-th element in a set (counting from zero)

int d[200005], v[200005];

int main() {
  fastio;
  int n, s = 0, p = 1;
  cin >> n;
  for (int i=0; i<n; ++i) {
    int t;
    cin >> t;
    if (t == 1)  {
      int a, x;
      cin >> a >> x;
      s += x * a;
      d[a] += x;
    }
    if (t == 2) {
      int k;
      cin >> k;
      s += k;
      p++;
      v[p] = k;
    }
    if (t == 3) {
      s -= v[p] + d[p];
      d[p - 1] += d[p];
      d[p] = 0;
      p--;
    }
    cout << setprecision(15) << (ld) s / (ld) p << "\n";
  }
  return 0;
}


// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mp make_pair
#define pi pair<int,int>
#define pl pair<long long int,long long int>
#define pb push_back
#define fi first
#define se second
#define sz(a) (int)(a).size()

typedef long long int ll;
typedef long double ld;

using namespace std;

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

// order_of_key (k) : Number of items strictly smaller than k, basically 0-based index of k
// find_by_order(k) : K-th element in a set (counting from zero)

int d[200005], v[200005];

int main() {
  fastio;
  int n, s = 0, p = 1;
  cin >> n;
  for (int i=0; i<n; ++i) {
    int t;
    cin >> t;
    if (t == 1)  {
      int a, x;
      cin >> a >> x;
      s += x * a;
      d[a] += x;
    }
    if (t == 2) {
      int k;
      cin >> k;
      s += k;
      p++;
      v[p] = k;
    }
    if (t == 3) {
      s -= v[p] + d[p];
      p--;
    }
    cout << setprecision(15) << (ld) s / (ld) p << "\n";
  }
  return 0;
}


//-----HEADER-----
#include<bits/stdc++.h>
using namespace std;

//-----MACROS-----
#define int long long
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define vc vector
#define nl '\n'
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for (int i=a; i<b; ++i)
#define rev(i,a,b) for (int i=a; i>b; --i)
#define IOS ios_base::sync_with_stdio(false)
#define setpr(x) cout<<setprecision(x)<<fixed
#define sz size()
#define N 100005

//-----TEMPLATES-----
template<typename... T>
void see(T&... args) {
	((cin >> args), ...);
}

template<typename... T>
void put(T&&... args) {
	((cout << args << " "), ...);
}

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

//-----CONSTANTS-----
const ll inf = INT_MAX;
const ld ep = 0.0000001;
const ld pi = acos(-1.0);
const ll md = 1000000007;

//-----GLOBALS-----
int tree[N+1]={0};
void update(int n, int x,int val){
	for(;x<=n; x+=x&-x) tree[x]+=val;
}
int query(int x){
	int s=0;
	for(;x>0;x-=x&-x) s+=tree[x];
	return s;
}
int i=2;
//-----SOLUTION-----
void solve(){
	//range update
	int m; see(m);
	ld s=0, n=1;
	vi v={0};
	while(m--){
		int t; see(t);
		if (t==2){
			int x; see(x);
			s+=x; n++;
			int vl = query(i-1);
			update(i,i,x-vl);i++;
		}
		else if (t==1){
			int y,x; see(y,x);
			update(i-1,1,x), update(i-1,y+1,-x);
			s+= (y*x);
		}
		else {
			int vl = query(i-1);
			s-=vl; n--;
			update(i-1,i-1,-vl);i--;
		}
		cout<<s/n<<nl;
	}
}

//-----MAIN-----
signed main(){
	IOS;

	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w", stdout);
    #endif

	int t=1;
	//cin>>t;
	while(t--) {
		solve();
		//cout<<nl;
	}

}


//-----HEADER-----
#include<bits/stdc++.h>
using namespace std;

//-----MACROS-----
#define int long long
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define vc vector
#define nl '\n'
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for (int i=a; i<b; ++i)
#define rev(i,a,b) for (int i=a; i>b; --i)
#define IOS ios_base::sync_with_stdio(false)
#define setpr(x) cout<<setprecision(x)<<fixed
#define sz size()
#define N 200005

//-----TEMPLATES-----
template<typename... T>
void see(T&... args) {
	((cin >> args), ...);
}

template<typename... T>
void put(T&&... args) {
	((cout << args << " "), ...);
}

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

//-----CONSTANTS-----
const ll inf = INT_MAX;
const ld ep = 0.0000001;
const ld pi = acos(-1.0);
const ll md = 1000000007;

//-----GLOBALS-----
double d[N]={0};
int a[N]={0};
//-----SOLUTION-----
void solve(){
	setpr(8);
	int m; see(m);
	double s=0; int n=1;
	while(m--){
		int t; see(t);
		if (t==2){
			int x; see(x);
			s+=x; n++;
			a[n]=x;
		}
		else if (t==1){
			int y,x; see(y,x);
			d[y]+=x;
			s+= (y*x);
		}
		else {
			int x = d[n] + a[n];
			d[n-1]+=d[n];
			d[n]=0;
			a[n]=0;
			s-=x; n--;
		}
		cout<<s/n<<nl;
	}
}

//-----MAIN-----
signed main(){
	IOS;

	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w", stdout);
    #endif

	int t=1;
	//cin>>t;
	while(t--) {
		solve();
		//cout<<nl;
	}

}


//-----HEADER-----
#include<bits/stdc++.h>
using namespace std;

//-----MACROS-----
#define int long long
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define vc vector
#define nl '\n'
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for (int i=a; i<b; ++i)
#define rev(i,a,b) for (int i=a; i>b; --i)
#define IOS ios_base::sync_with_stdio(false)
#define setpr(x) cout<<setprecision(x)<<fixed
#define sz size()
#define N 200005

//-----TEMPLATES-----
template<typename... T>
void see(T&... args) {
	((cin >> args), ...);
}

template<typename... T>
void put(T&&... args) {
	((cout << args << " "), ...);
}

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

//-----CONSTANTS-----
const ll inf = INT_MAX;
const ld ep = 0.0000001;
const ld pi = acos(-1.0);
const ll md = 1000000007;

//-----GLOBALS-----
int tree[N+1]={0};
void update(int n, int x,int val){
	for(;x<=n; x+=x&-x) tree[x]+=val;
}
int query(int x){
	int s=0;
	for(;x>0;x-=x&-x) s+=tree[x];
	return s;
}
int find(int x){
	int c=0;
	while(!(x&1)){
		x>>=1; c++;
	}
	c = pow(2,c);
	return (query(x-1)-query(x-c));
}
int i=2;
//-----SOLUTION-----
void solve(){
	//range update
	setpr(10);
	int m; see(m);
	ld s=0, n=1;
	vi v={0};
	while(m--){
		int t; see(t);
		if (t==2){
			int x; see(x);
			s+=x; n++;
			int vl = query(i-1);
			int v = find(i);
			update(i,i,x-vl+v);i++;
		}
		else if (t==1){
			int y,x; see(y,x);
			update(i-1,1,x), update(i-1,y+1,-x);
			s+= (y*x);
		}
		else {
			int vl = query(i-1);
			s-=vl; n--;
			tree[i-1]=0;i--;
		}
		cout<<s/n<<nl;
	}
}

//-----MAIN-----
signed main(){
	IOS;

	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w", stdout);
    #endif

	int t=1;
	//cin>>t;
	while(t--) {
		solve();
		//cout<<nl;
	}

}