#include<bits/stdc++.h>
using namespace std;
const int N=5e8;
int a[N];
int main(){
int n,to=1;
cin>>n;
for(int i=1;i<=n;i++)
{
int op,x,y;
cin>>op;
if(op==1)
{
cin>>x>>y;
for(int j=x;j<=y;j++)
{
a[to]=j;
to++;
}
}
if(op==2)
{
int l=0;
cin>>x;
for(int j=0;j<x;j++)
{
l+=a[to-1];
to--;
}
cout<<l<<endl;
}
}
return 0;
}