#include<stdio.h>
#include<iostream>
#define gc getchar
#define ll long long int
inline ll input() {
char c = gc();
while(c<'0' || c>'9') c = gc();
ll ret = 0;
while(c>='0' && c<='9') {
ret = 10 * ret + c - 48;
c = gc();
}
return ret;
}
ll maxi;
ll array[1000003];
void bt1(ll index,ll value)
{
while(index<=maxi)
{
array[index]=array[index]+value;
index=index+(index & -index);
}
}
ll qt(ll a)
{
ll sum=0;
while(a>0)
{
sum=sum+array[a];
a=a-(a & -a);
}
return sum;
}
int main()
{
using namespace std;
ll n,m,c,i,x,y,z,a,ans;
string s;
n=input();
m=input();
c=input();
maxi=n+1;
for(i=0;i<1000003;i++)
array[i]=0;
for(i=1;i<=n;i++)
bt1(i,c);
if(m>0)
while(m--)
{
cin>> s;
if(s[0]=='S')
{
x=input();
y=input();
z=input();
bt1(x,z);
bt1(y+1,-z);
}
else
{
a=input();
ans=qt(a);
printf("%lld\n",ans);
}
}
return 0;
}
I2luY2x1ZGU8c3RkaW8uaD4KCiNpbmNsdWRlPGlvc3RyZWFtPgoKI2RlZmluZSBnYyBnZXRjaGFyCgojZGVmaW5lIGxsIGxvbmcgbG9uZyBpbnQKCmlubGluZSBsbCBpbnB1dCgpIHsKCiAgY2hhciBjID0gZ2MoKTsKCiAgd2hpbGUoYzwnMCcgfHwgYz4nOScpIGMgPSBnYygpOwoKICBsbCByZXQgPSAwOwoKICB3aGlsZShjPj0nMCcgJiYgYzw9JzknKSB7CgogICAgcmV0ID0gMTAgKiByZXQgKyBjIC0gNDg7CgogICAgYyA9IGdjKCk7CgogIH0KCiAgcmV0dXJuIHJldDsKCn0KCmxsIG1heGk7CgpsbCBhcnJheVsxMDAwMDAzXTsKCnZvaWQgYnQxKGxsIGluZGV4LGxsIHZhbHVlKQoKewoKCXdoaWxlKGluZGV4PD1tYXhpKQoKCXsKCgkJYXJyYXlbaW5kZXhdPWFycmF5W2luZGV4XSt2YWx1ZTsKCgkJaW5kZXg9aW5kZXgrKGluZGV4ICYgLWluZGV4KTsKCg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