#include
using namespace std;
typedef struct node
{
char c;
int num1,num2,ans;
struct node *next;
}node;
class sidd
{
node *head;
public:
sidd()
{
head=NULL;
}
void create(int);
void display(long int, long int []);
};
void sidd::create(int n)
{
int i;
node *temp;
for(i=0;i<n;i++)
{
node *nNode=new node;
// cout<<"\nenter char";
cin>>nNode->c>>nNode->num1>>nNode->num2;
nNode->next=NULL;
if(head==NULL)
head=nNode;
else
{
temp=head;
while(temp->next!=NULL)
{
temp=temp->next;
}
temp->next=nNode;
}
}
}
void sidd::display( long int n, long int arr[])
{
node *temp;
int n1,sum,i;
sum=0;
temp=head;
while(temp!=NULL)
{
if(temp->c==‘q’)
{
for(i=temp->num1;i<=temp->num2;i++)
sum=sum+arr[i];
cout<<"\n"<<sum;
temp=temp->next;
}
else
{
n1=arr[temp->num1]+temp->num2;
arr[temp->num1]=n1;
temp=temp->next;
}
sum=0;
}
}
int main()
{
long int a[1000000];
long int n,i,n1;
sidd s;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>a[i];
}
cin>>n1;
s.create(n1);
s.display(n,a);
}