#include<bits/stdc++.h>
using namespace std;
int stack1[500005],p = 0;
void push(int num){
p++;
stack1[p] = num;
}
long long top(){
return stack1[p];
}
void pop(){
if(p > 0){
p--;
}
}
int main(){
long long n,x,l,r,s;
cin>>n;
for(int i = 1;i <= n;i++){
cin>>x;
if(x == 1){
cin>>l>>r;
for(int i = l;i <= r;i++){
push(i);
}
}else if(x == 2){
cin>>s;
int m = 0;
while(s--){
m += top();
pop();
}
cout<<m<<endl;
}
}
return 0;
}