#include<stdio.h>
#include<iostream>
#define gc getchar
typedef long long ll;
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;
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')
{
bt1(x,z);
bt1(y+1,-z);
}
else
{
ans=qt(a);
printf("%lld\n",ans);
}
}
return 0;
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGU8aW9zdHJlYW0+CiNkZWZpbmUgZ2MgZ2V0Y2hhcgp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKbGwgbWF4aTsKbGwgYXJyYXlbMTAwMDAwM107CnZvaWQgYnQxKGxsIGluZGV4LGxsIHZhbHVlKQp7Cgl3aGlsZShpbmRleDw9bWF4aSkKCXsKCQlhcnJheVtpbmRleF09YXJyYXlbaW5kZXhdK3ZhbHVlOwoJCWluZGV4PWluZGV4KyhpbmRleCAmIC1pbmRleCk7Cgl9Cn0KbGwgcXQobGwgYSkKewoJbGwgc3VtPTA7Cgl3aGlsZShhPjApCgl7CgkJc3VtPXN1bSthcnJheVthXTsKCQlhPWEtKGEgJiAtYSk7Cgl9CglyZXR1cm4gc3VtOwp9CmludCBtYWluKCkKewoJdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCWxsIG4sbSxjLGkseCx5LHosYSxhbnM7CglzdHJpbmcgczsKCW1heGk9bisxOwoJZm9yKGk9MDtpPDEwMDAwMDM7aSsrKQoJYXJyYXlbaV09MDsKCWZvcihpPTE7aTw9bjtpKyspCglidDEoaSxjKTsKCWlmKG0+MCkKCXdoaWxlKG0tLSkKCXsKCQljaW4+PiBzOwoJCQoJCWlmKHNbMF09PSdTJykKCQl7CgkJCWJ0MSh4LHopOwoJCQlidDEoeSsxLC16KTsKCQl9CgkJZWxzZQoJCXsKCQkJYW5zPXF0KGEpOwoJCQlwcmludGYoIiVsbGRcbiIsYW5zKTsKCQl9Cgl9CglyZXR1cm4gMDsKfQ==