#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXQ = 1e6;
pair<int, int> a[MAXQ];
signed main() {
int textcase;
cin >> textcase;
int tail = 0, head = 1;
for(int i = 1; i <= textcase; i++) {
int op, c, x;
cin >> op;
if(op == 1) {
cin >> x >> c;
a[++tail].first = x;
a[tail].second = c;
}else if(op == 2) {
cin >> c;
int sum = 0;
while(c >= a[head].second) {
c -= a[head].second;
sum += a[head].second * a[head].first;
head++;
}
sum += c * a[head].first;
a[head].second -= c;
cout << sum << endl;
}
}
return 0;
}