#include<stdio.h>
#include<queue>
using namespace std;
queue <int> q;
int main(){
	int n, a, b, i, cnt;
	scanf("%d", &n);
	for(i=0;i<n;i++){
		scanf("%d %d", &a, &b);
		if(a==1){
			q.push(b);
		}else{
			cnt = 0;
			while(b--){
				cnt += q.front();
				q.pop();
			}
			q.push(cnt);
		}
	}
	while(!q.empty()){
		printf("%d ", q.front());
		q.pop();
	}
}
