#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cmath>
#include<iomanip>
using namespace std;
long long int n,i,j,m,sum,sumend,dr,a[2006811],ch,v[2006811],c[2006811],s1[2006811],s2[2006811],b,c1,k;
bool cmp(int a,int b)
{
	return a>b;
}
int gcd(int a,int b)
{
	if(!b)
		return a;
	return gcd(b,a%b);
}
long long int maxx(int a,int b)
{
    if(a>=b)
        return a;
    return b;
}
long double maxxx(long double a,long double b)
{
    if(a>=b)
        return a;
    return b;
}
long long int lhd(long long int a)
{
	if(a<=0)
		return -a;
	return a;
}
long long int lhdmin(long long int a,long long int b)
{
	if(a<=b)
		return a;
	return b;
}
long long int dcecs(long long int n)
{
	if(n<2)
		return 0;
	if(n==2)
		return 1;
	for(int i=3;i<=sqrt(n);i+=2)
		if(n%i==0)
			return 0;
	return 1;
}
bool gqt(int x,int y)
{
	if(x+y==-2)
		return 1;
	if(x!=-1&&y!=-1&&v[x]==v[y]&&gqt(s2[x],s1[y])&&gqt(s1[x],s2[y]))
		return 1;
	return 0;
}
void xjbs(int n)
{
	c[n]=1;
	if(s1[n]!=-1)
	{
		xjbs(s1[n]);
		c[n]+=c[s1[n]];
	}
	if(s2[n]!=-1)
	{
		xjbs(s2[n]);
		c[n]+=c[s2[n]];
	}	
}
long long int minnn(long long int a,long long int b)
{
    if(a<=b)
        return a;
    return b;
}
long long int gqt(long long int b,long long int p,long long int k)
{
    /*if(p==0)
        return 1;
    if(k==1)
        return 0;
    if(b%2==1)
        return gqt(b,p/2,k)%k*b%k*gqt(b,p/2,k)%k;
    else if(b%2==0)
        return gqt(b,p/2,k)%k*gqt(b,p/2,k)%k;*/
    long long int sum=1;
    while(p!=0)
	{
	    if(p%2==1)
		{
			sum*=b;
			sum%=k;
		}
		b*=b;
		b%=k;	
		p/=2;
	}
	return sum;
}
const int k1=1e9+9;
string a1,a2;
long double dol=100.0,mark,lsbl;
long long int la2,x1,x2,x3,x4,flag[205]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
//long long int n,m,i,j,sum,sumend,a[71720],b,la,left1[71720],right1[71720],dp[5271720],maxx,minn,sj,x,y,p;
int main()
{
    /*cin>>n>>k;
    for(i=1;i<=n;i++)
        cin>>aa[i];
    for(i=1;i<=n;i++)
        sum[i]=sum[i-1]+aa[i];
    for(i=k;i<=n;i++)
        sumend=maxx(sumend,sum[i]-sum[i-k]);
    cout<<sumend<<endl;*/
    /*cin>>a1;
    int la=a1.size();
    for(i=0;i<la;i++)
    {
        if(a1[i]=='0')
        {
            a2[la2]='0';
            la2++;
            //break;
        }
        if(a1[i]=='1')
        {
            a2[la2]='1';
            la2++;
            //break;
        }
        if(a1[i]=='B')
            if(la2!=0)
            {
                la2--;
                //break;
            }
                
    }
    for(i=0;i<la2;i++)
        cout<<a2[i];
    cout<<endl;
    cin>>x1>>x2>>x3;
    for(i=1;i<=10000;i++)
        if(x1*i%x2==x3)
        {
            cout<<"YES"<<endl;
            return 0;
        }
    cout<<"NO"<<endl;
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+n+1);
    for(i=2;i<=n;i++)
        if(a[i]==a[i-1])
            sumend++;
    cout<<sumend<<endl;
    cin>>a1;
    int la=a1.size();
    for(i=0;i<la;i++)
    {
        if(a1[i]!='o'&&a1[i]!='k'&&a1[i]!='u')
        {
            if(a1[i]=='c'&&a1[i+1]=='h')
                i++;
            else
            {
                cout<<"NO"<<endl;
                return 0;
            }
        }
            
    }
    cout<<"YES"<<endl;
    cin>>x1>>x2>>x3>>x4;
    cout<<x1*1728+x2*144+x3*12+x4<<endl;*/
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>a[i];
    for(i=1;i<=n;i++)
        sum+=a[i];
    sumend=sum;
    cin>>m;
    while(m--)
    {
        x1=x2=0;
        cin>>x1>>x2;
        if(x2>=a[x1]) 
            sum+=(x2-a[x1]);
        else 
            sum-=(a[x1]-x2);
        cout<<sum<<endl;
        sum=sumend;
    }
    return 0;
}


Measured memory_bytes: 2304