1 #include<set>
2 #include<queue>
3 #include<cstdio>
4 #include<cstdlib>
5 #include<cstring>
6 #include<iostream>
7 #include<algorithm>
8 using namespace std;
9 typedef long long LL;
10 const LL N = 100100;
11 const LL MOD = 20130426;
12 #define fa(i) (T[i].p)
13 #define L(i) (T[i].s[0])
14 #define R(i) (T[i].s[1])
15 #define CUR (L(R(root)))
16 #define Loc(i) (T[fa(i)].s[1] == i)
17 #define For(i,n) for(LL i=1;i<=n;i++)
18 #define Rep(i,l,r) for(LL i=l;i<=r;i++)
19 #define Sets(a,b,c) {if(a) T[a].s[c] = b; if(b) fa(b) = a;}
20 struct tnode{
21 LL s[2],p,size;
22 LL markp,markm,v;
23 }T[N+100];
24 char op[10];
25 LL val,n,l,r,delta,tot,ans,pows = 1;
26 LL root;
27
28 void Update(LL i){
29 T[i].size = T[L(i)].size + T[R(i)].size + 1;
30 }
31
32 void Pushdown(LL i){
33 if(T[i].markm==1&&T[i].markp==0) return;
34 if(L(i)){
35 T[L(i)].markm = ( T[L(i)].markm * T[i].markm) % MOD;
36 T[L(i)].markp = ( T[L(i)].markp * T[i].markm + T[i].markp) % MOD;
37 T[L(i)].v = ( T[L(i)].v * T[i].markm + T[i].markp) % MOD;
38 }
39 if(R(i)){
40 T[R(i)].markm = ( T[R(i)].markm * T[i].markm) % MOD;
41 T[R(i)].markp = ( T[R(i)].markp * T[i].markm + T[i].markp) % MOD;
42 T[R(i)].v = ( T[R(i)].v * T[i].markm + T[i].markp) % MOD;
43 }
44 T[i].markm = 1; T[i].markp = 0;
45 }
46
47 void Build(LL l,LL r,LL &i,LL p){
48 if(l>r) return;
49 T[i=++tot].p = p; T[i].size = T[i].markm = 1; T[i].markp = T[i].v = 0;
50 LL m = (l+r)>>1;
51 Build(l,m-1,L(i),i);Build(m+1,r,R(i),i);
52 Update(i);
53 }
54
55 LL read(){
56 LL num = 0; char ch = getchar();
57 while(ch<‘0‘||ch>‘9‘) ch = getchar();
58 while((ch>=‘0‘)&&(ch<=‘9‘)){
59 num = num * 10 + ch - ‘0‘;
60 ch = getchar();
61 }
62 return num;
63 }
64
65 void Clear(LL i){
66 T[i].p = T[i].markp = T[i].size = T[i].v = 0;
67 T[i].markm = 1;
68 }
69
70 void Rot(LL x){
71 LL y = fa(x) , z = fa(y);
72 Pushdown(y); Pushdown(x);
73 LL lx = Loc(x) , ly = Loc(y);
74 Sets(y,T[x].s[!lx],lx);
75 Sets(z,x,ly);
76 Sets(x,y,!lx);
77 Update(y);
78 }
79
80 void Splay(LL i,LL goal){
81 while(fa(i)!=goal){
82 if(fa(fa(i))!=goal) Rot(fa(i));
83 Rot(i);
84 }
85 Update(i);
86 if(!goal) root = i;
87 }
88
89 bool dlim = false;
90
91 void query(LL val,LL i){
92 Pushdown(i);
93 if(L(i)) query(val,L(i));
94 if(!dlim) dlim = true;
95 else { ans = ( ans + (T[i].v * pows) % MOD ) % MOD; pows = ( pows * val ) % MOD;}
96 if(R(i)) query(val,R(i));
97 }
98
99 LL Rank(LL kth,LL i){
100 Pushdown(i);
101 if(T[L(i)].size + 1 == kth) return i;
102 else if(T[L(i)].size>= kth) return Rank(kth,L(i));
103 else return Rank(kth - T[L(i)].size - 1 , R(i));
104 }
105
106 int main(){
107 n = read();
108 Build(0,N,root,0);
109 For(i,n){
110 scanf("%s",&op);
111 if(op[0]==‘q‘){
112 val = read();dlim = false;pows = 1;
113 query(val,root);
114 printf("%lld\n",ans);
115 ans = 0;
116 }
117 else{
118 l = read(); r = read();
119 l++;r++;
120 if(op[0]==‘a‘){
121 val = read();
122 Splay(Rank(l,root),0);
123 Splay(Rank(r+2,root),root);
124 T[CUR].markp = (T[CUR].markp + val) % MOD;
125 T[CUR].v = (T[CUR].v + val) % MOD;
126 }
127 else if(op[3]==‘x‘){
128 Splay(Rank(r,root),0);Splay(Rank(r+2,root),root);
129 LL tcur = CUR;
130 T[R(root)].v = ( T[R(root)].v + T[CUR].v ) % MOD;
131 Clear(CUR);T[R(root)].s[0] = 0;
132 Update(R(root)); Update(root);
133 Splay(Rank(l,root),0);Splay(Rank(l+1,root),root);
134 Sets(R(root),tcur,0);T[tcur].size = 1;
135 Update(R(root)); Update(root);
136 }
137 else{
138 val = read();
139 Splay(Rank(l,root),0);
140 Splay(Rank(r+2,root),root);
141 T[CUR].markp = (T[CUR].markp * val) % MOD;
142 T[CUR].markm = (T[CUR].markm * val) % MOD;
143 T[CUR].v = (T[CUR].v * val) % MOD;
144 }
145 }
146 }
147 return 0;
148 }