Joisino is about to compete in the final round of a certain programming competition.
In this contest, there are N problems, numbered 1 through N.
Joisino knows that it takes her T_i seconds to solve problem i(1≦i≦N).
Also, there are M kinds of drinks offered to the contestants, numbered 1 through M.
If Joisino takes drink i(1≦i≦M), her brain will be stimulated and the time it takes for her to solve problem P_i will become X_i seconds.
It does not affect the time to solve the other problems.
A contestant is allowed to take exactly one of the drinks before the start of the contest.
For each drink, Joisino wants to know how many seconds it takes her to solve all the problems if she takes that drink.
Here, assume that the time it takes her to solve all the problems is equal to the sum of the time it takes for her to solve individual problems.
Your task is to write a program to calculate it instead of her.

-----Constraints-----
 - All input values are integers.
 - 1≦N≦100
 - 1≦T_i≦10^5
 - 1≦M≦100
 - 1≦P_i≦N
 - 1≦X_i≦10^5

-----Input-----
The input is given from Standard Input in the following format:
N
T_1 T_2 ... T_N
M
P_1 X_1
P_2 X_2
:
P_M X_M

-----Output-----
For each drink, calculate how many seconds it takes Joisino to solve all the problems if she takes that drink, and print the results, one per line.

-----Sample Input-----
3
2 1 4
2
1 1
2 3

-----Sample Output-----
6
9

If Joisino takes drink 1, the time it takes her to solve each problem will be 1, 1 and 4 seconds, respectively, totaling 6 seconds.
If Joisino takes drink 2, the time it takes her to solve each problem will be 2, 3 and 4 seconds, respectively, totaling 9 seconds.
[{"code": "N = int(input())\nT = [int(TN) for TN in input().split()]\nSumT = sum(T)\nM = int(input())\nPX = [[] for TM in range(0,M)]\nfor TM in range(0,M):\n    PX[TM] = [int(TPX) for TPX in input().split()]\nfor TM in range(0,M):\n    print(SumT-T[PX[TM][0]-1]+PX[TM][1])", "passed": true, "time": 0.15, "memory": 14112.0, "status": "done"}, {"code": "n = int(input())\nli = list(map(int,input().split()))\nm = int(input())\nc = sum(li)\nfor i in range(m):\n    a,b = map(int,input().split())\n    print(c-li[a-1]+b)", "passed": true, "time": 0.15, "memory": 14116.0, "status": "done"}, {"code": "N=int(input())\nT=list(map(int,input().split()))\nM=int(input())\nP=[list(map(int, input().split())) for i in range(M)]\ntmp=0\nans=0\n\nfor i in range(M):\n    tmp=0\n    for j in range(len(T)):\n        if j == P[i][0]-1:\n            tmp +=P[i][1]\n        else:\n            tmp +=T[j]\n    print(tmp)", "passed": true, "time": 0.16, "memory": 14244.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int, input().split()))\nm = int(input())\ndr = [None] * m\ntime = sum(t)\nfor i in range(m):\n    p, x = list(map(int, input().split()))\n    p -= 1\n    ans = time - t[p] + x\n    print(ans)\n", "passed": true, "time": 0.35, "memory": 14140.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\nnum_drink = int(input())\n\nfor i in range(num_drink):\n    P,X = map(int,input().split())\n    A = a.copy()\n    A[P-1] = X\n    print(sum(A))", "passed": true, "time": 1.68, "memory": 14328.0, "status": "done"}, {"code": "N = int(input())\nT = list(map(int,input().split()))\nM = int(input())\nfor i in range(M):\n    Pi,Xi=map(int,input().split())\n    a = T[Pi-1]\n    T[Pi-1] = Xi\n    b = 0\n    for j in range(N):\n        b = b + T[j]\n    print(b)\n    T[Pi-1] = a", "passed": true, "time": 0.17, "memory": 14128.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int, input().split()))\nm = int(input())\np = [list(map(int,input().split())) for i in range(m)]\nans = []\nfor num in p:\n    print(sum(t) - t[num[0]-1] + num[1])", "passed": true, "time": 0.17, "memory": 14308.0, "status": "done"}, {"code": "n=int(input())\nl=[0]+list(map(int,input().split()))\nans=sum(l)\nfor i in range(int(input())):\n  a,s=list(map(int,input().split()))\n  print((ans-l[a]+s))\n", "passed": true, "time": 0.86, "memory": 14256.0, "status": "done"}, {"code": "n = int(input())\ndata_1 = list(map(int,input().split()))\nm = int(input())\ndata_2 = [input().split() for i in range(m)]\n\n\nfor i in range(m):\n    sum = 0\n    b = int(data_2[i][0]) - 1\n    a = data_1[b]\n    data_1[b] = int(data_2[i][1])\n    for j in range(n):\n        sum += data_1[j]\n    print(sum)\n    data_1[b] = a", "passed": true, "time": 0.15, "memory": 14264.0, "status": "done"}, {"code": "n = int(input())\nT = list(map(int, input().split()))\nm = int(input())\n\nsum_T = sum(T)\n\nfor i in range(m):\n    p,x = list(map(int, input().split()))\n    ans = sum_T - T[p-1] + x\n    print(ans)\n\n", "passed": true, "time": 0.14, "memory": 14040.0, "status": "done"}, {"code": "num_problems = int(input())\nt = [int(n) for n in input().split()]\ntotal = sum(t)\nnum_drinks = int(input())\n\nfor i in range(num_drinks):\n  m_id, m_val = [int(n) for n in input().split()]\n  ans = total - t[m_id-1] + m_val\n  print(ans)\n", "passed": true, "time": 0.17, "memory": 14292.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int, input().split()))\nm = int(input())\n\nfor i in range(m):\n    p, x = map(int, input().split())\n    a = t[p-1]\n    t[p-1] = x\n    print(sum(t))\n    t[p-1] = a", "passed": true, "time": 0.31, "memory": 14296.0, "status": "done"}, {"code": "N = int(input())\nT = list(map(int,input().split()))\nM = int(input())\n\nfor m in range(M):\n  P,X = list(map(int,input().split()))\n  T_ans = T.copy()\n  T_ans[P-1] = X\n  print((sum(T_ans)))\n", "passed": true, "time": 0.17, "memory": 14040.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int,input().split()))\nm = int(input())\ns = sum(t)\nfor i in range(m):\n    p,x = map(int,input().split())\n    print(s-t[p-1]+x)", "passed": true, "time": 0.17, "memory": 14264.0, "status": "done"}, {"code": "N = int(input())\ntimes = list(map(int, input().split()))\n\nM = int(input())\ndrinks = [tuple(map(int, input().split()))\n          for _ in range(M)]\n\ntime_sum_raw = sum(times)\nfor pi, xi in drinks:\n    print((time_sum_raw - times[pi - 1] + xi))\n", "passed": true, "time": 0.14, "memory": 14076.0, "status": "done"}, {"code": "import copy\nn = int(input())\nt = [int(x) for x in input().split()]\nm = int(input())\nfor i in range(m):\n    p, x = map(int, input().split())\n    t_temp = copy.copy(t)\n    t_temp[p - 1] = x\n    print(sum(t_temp))", "passed": true, "time": 0.15, "memory": 14040.0, "status": "done"}, {"code": "n = int(input())\ntimes = list(map(int, input().split()))\nm = int(input())\ndrinks = []\nfor _ in range(m):\n    drink = list(map(int, input().split()))\n    drinks.append(drink)\n\nfor drink in drinks:\n    time = 0\n    copy = times.copy()\n    copy[drink[0]-1] = drink[1]\n    for i in copy:\n        time += i\n    print(time)", "passed": true, "time": 0.23, "memory": 14160.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int, input().split()))\nm = int(input())\nfor i in range(m):\n  p,x = map(int, input().split())\n  print(sum(t)-t[p-1]+x)", "passed": true, "time": 0.14, "memory": 14068.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int, input().split()))\nm = int(input())\npx = [list(map(int, input().split())) for _ in range(m)]\nfor i in range(m):\n    p, x = px[i][0], px[i][1]\n    p -= 1\n    cnt = 0\n    for j in range(n):\n        if p == j:\n            cnt += x\n        else :\n            cnt += t[j]\n    print(cnt)\n", "passed": true, "time": 0.14, "memory": 14096.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int, input().split()))\nm = int(input())\np = [0 for _ in range(m)]\nx = [0 for _ in range(m)]\nfor i in range(m):\n    p[i], x[i] = map(int, input().split())\n\ntemp = sum(t)\n\nfor i in range(m):\n    print(temp + (x[i] - t[p[i]-1]))", "passed": true, "time": 0.14, "memory": 14352.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int, input().split()))\ns = sum(t)\nm = int(input())\nfor i in range(m):\n  p, x = list(map(int, input().split()))\n  print((s - t[p -1] + x))\n", "passed": true, "time": 0.14, "memory": 14116.0, "status": "done"}, {"code": "n = int(input())\nt_lst = list(map(int, input().split()))\nm = int(input())\n\nfor i in range(m):\n    p, x = list(map(int, input().split()))\n    count = 0\n    for j in range(n):\n        if j == p-1:\n            count += x\n        else:\n            count += t_lst[j]\n    print(count)\n\n", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int, input().split()))\ntotal = sum(t)\nm = int(input())\nfor i in range(m):\n    p, x = map(int, input().split())\n    p -= 1\n    print(total - t[p] + x)", "passed": true, "time": 0.14, "memory": 14216.0, "status": "done"}, {"code": "N=int(input())\nT=input()\nM=int(input())\nP=[input() for i in range(M)]\n\ndef ans050(N:int, T:str, M:int, P:list):\n    T_list=list(map(int,T.split()))\n    ans_list=[]\n    for i in range(M):\n        T_list = list(map(int, T.split()))\n        P_list=list(map(int,P[i].split()))\n        del T_list[P_list[0]-1]\n        T_list.append(P_list[1])\n        ans_list .append(sum(T_list))\n    return ans_list\nfor i in range(M):\n    print((ans050(N,T,M,P))[i])", "passed": true, "time": 0.14, "memory": 14124.0, "status": "done"}, {"code": "n=int(input())\nt=list(map(int,input().split()))\nm=int(input())\nfor j in range(m):\n    ans=0\n    p,x=map(int,input().split())\n    for k in range(n):\n        if p==k+1:\n            ans += x\n        else:\n            ans += t[k]\n    print(ans)", "passed": true, "time": 0.14, "memory": 14200.0, "status": "done"}, {"code": "N = int(input())\nT = list(map(int, input().split()))\nM = int(input())\nfor i in range(M):\n    P, X = list(map(int, input().split()))\n    Y = T[P-1]\n    T[P-1] = X\n    print((sum(T)))\n    T[P-1] = Y\n", "passed": true, "time": 0.23, "memory": 14340.0, "status": "done"}, {"code": "n = int(input())\narr = list(map(int, input().split()))\nm = int(input())\n\nfor _ in range(m):\n    p, x = list(map(int, input().split()))\n    print((sum(arr[0:p - 1]) + sum(arr[p:]) + x))\n", "passed": true, "time": 0.23, "memory": 14320.0, "status": "done"}, {"code": "import sys,bisect\n\nfrom sys  import stdin,stdout\n\nfrom bisect import bisect_left,bisect_right,bisect,insort,insort_left,insort_right\n\nfrom math import gcd,ceil,floor,sqrt\n\nfrom collections import Counter,defaultdict,deque,OrderedDict\n\nfrom queue import Queue,PriorityQueue\n\nfrom string import ascii_lowercase\n\n\nsys.setrecursionlimit(10**6)\nINF = float('inf')\nMOD = 998244353\nmod = 10**9+7\n\ndef isPrime(n):\n    if (n <= 1) :return False\n    if (n <= 3) :return True\n    if (n%2 == 0 or n%3 == 0):return False\n    for i in range(5,ceil(sqrt(n))+1,6):\n        if (n%i==0 or n%(i+2)==0):\n            return False\n    return True\n\ndef st():\n    return list(stdin.readline().strip())\n\ndef inp():\n    return int(stdin.readline())\n\ndef li():\n    return list(map(int,stdin.readline().split()))\n\ndef mp():\n    return list(map(int,stdin.readline().split()))\n\ndef pr(n):\n    stdout.write(str(n)+\"\\n\")\n    \ndef DFS(dictionary,vertex,visited):\n    visited[vertex]=True\n    stack=[vertex]\n    print(vertex)\n    while stack:\n        a=stack.pop()\n        for i in dictionary[a]:\n            if not visited[i]:\n                print(i)\n                visited[i]=True\n                stack.append(i)\n\n\ndef BFS(dictionary, vertex,visited):\n    visited[vertex]=True\n    q=deque()\n    q.append(vertex)\n    while q:\n        a=q.popleft()\n        for i in dictionary[a]:\n            if not visited[i]:\n                visited[i]=True\n                q.append(i)\n                print(i)\n\n                \n\n\ndef soe(limit):\n    l=[1]*(limit+1)\n    l[0]=0\n    l[1]=0\n    prime=[]\n    for i in range(2,limit+1):\n        if l[i]:\n            for j in range(i*i,limit+1,i):\n                l[j]=0\n    \n    for i in range(2,limit+1):\n        if l[i]:\n            prime.append(i)\n    return prime\n\ndef segsoe(low,high):\n    limit=int(high**0.5)+1\n    prime=soe(limit)\n    n=high-low+1\n    l=[0]*(n+1)\n    for i in range(len(prime)):\n        lowlimit=(low//prime[i])*prime[i]\n        if lowlimit<low:\n            lowlimit+=prime[i]\n        if lowlimit==prime[i]:\n            lowlimit+=prime[i]\n        for j in range(lowlimit,high+1,prime[i]):\n            l[j-low]=1\n    for i in range(low,high+1):\n        if not l[i-low]:\n            if i!=1:\n                print(i)\n                \ndef gcd(a,b):\n    while b:\n        a=a%b\n        b,a=a,b\n    return a\n\ndef power(a,n):\n    r=1\n    while n:\n        if n&1:\n            r=(r*a)\n        a*=a\n        n=n>>1\n    return r\n            \n    \ndef solve():\n    n=inp()\n    l=li()\n    s=sum(l)\n    d={i+1:l[i] for i in range(n)}\n    m=inp()\n    for i in range(m):\n        x=s\n        a,b=mp()\n        x-=d[a]\n        x+=b\n        pr(x)\n\n\nfor _ in range(1):\n    solve()\n    \n", "passed": true, "time": 0.14, "memory": 14400.0, "status": "done"}, {"code": "N = int(input())\nT = list(map(int, input().split()))\nM = int(input())\nP = []\nX = []\nfor i in range(M):\n    p, x = list(map(int, input().split()))\n    P.append(p)\n    X.append(x)\n\nSum = sum(T)\nfor i in range(M):\n    print((Sum - T[P[i] - 1] + X[i]))\n", "passed": true, "time": 0.15, "memory": 14228.0, "status": "done"}, {"code": "input();t=list(map(int,input().split()));T=sum(t)\nprint(*[T-t[i-1]+j for i,j in [list(map(int,input().split())) for _ in range(int(input()))]],sep='\\n')", "passed": true, "time": 0.14, "memory": 14376.0, "status": "done"}, {"code": "n = int(input())\ntl = list(map(int, input().split()))\ntime = sum(tl)\nm = int(input())\n\nfor _ in range(m):\n    p, x = list(map(int, input().split()))\n    print((time - (tl[p-1]-x)))\n", "passed": true, "time": 0.22, "memory": 14288.0, "status": "done"}, {"code": "#!/usr/bin/env python3\nn=int(input())\nt=list(map(int,input().split()))\nm=int(input())\nfor _ in range(m):\n    p,x=map(int,input().split())\n    t_true=t[p-1]\n    t[p-1]=x\n    print(sum(t))\n    t[p-1]=t_true", "passed": true, "time": 0.15, "memory": 14280.0, "status": "done"}, {"code": "N = input()\nT = [int(x) for x in input().split()]\nM = int(input())\nDrink = [tuple(map(int,input().split())) for _ in range(M)]\nsumT = sum(T)\nfor p,x in Drink:\n    print(sumT-T[p-1]+x)", "passed": true, "time": 0.14, "memory": 14144.0, "status": "done"}, {"code": "n=int(input())\nl=list(map(int,input().split()))\nm=int(input())\n\nsum_l=sum(l)\n\nfor i in range(m):\n  p,x=list(map(int,input().split()))\n  ans=sum_l-l[p-1]+x\n  print(ans)\n", "passed": true, "time": 0.14, "memory": 14148.0, "status": "done"}, {"code": "n = int(input())\nt_lst = list(map(int, input().split()))\nm = int(input())\npx_lst = [list(map(int, input().split())) for _ in range(m)]\n\ntime_lst = []\nfor i in range(m):\n    problem = px_lst[i][0] - 1\n    time = px_lst[i][1]\n    before = t_lst[problem]\n    t_lst[problem] = time\n    time_lst.append(sum(t_lst))\n    t_lst[problem] = before\n\nfor i in range(m):\n    print(time_lst[i])", "passed": true, "time": 0.15, "memory": 14052.0, "status": "done"}, {"code": "import copy\n\ndef main():\n    N = int(input())\n    T = list(map(int, input().split()))\n    M = int(input())\n    PX = []\n    for i in range(M):\n        P, X = list(map(int, input().split()))\n        tmp = copy.copy(T)\n        tmp[P-1] = X\n        print((sum(tmp)))\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14064.0, "status": "done"}, {"code": "import copy\nn = int(input())\nli = list(map(int,input().split()))\nlis = copy.copy(li)\nm = int(input())\ndri = [list(map(int,input().split())) for i in range(m)]\nfor i in range(len(dri)):\n    lis = copy.copy(li)\n    lis[dri[i][0]-1] = dri[i][1]\n    print(sum(lis))", "passed": true, "time": 0.22, "memory": 14200.0, "status": "done"}, {"code": "a=int(input())\nb=list(map(int,input().split()))\nc=int(input())\nd=[input().split() for i in range(c)]\nfor i in range(c):\n  print(sum(b)-b[int(d[i][0])-1]+int(d[i][1]))", "passed": true, "time": 0.22, "memory": 14096.0, "status": "done"}, {"code": "#!/usr/bin/env python3\nN = int(input())\nT = list(map(int, input().split()))\nM = int(input())\nP = [0] * M\nX = [0] * M\nfor i in range(M):\n    P[i], X[i] = list(map(int, input().split()))\n\nfor i in range(M):\n    ans = 0\n    ans += sum(T[:P[i] - 1])\n    ans += X[i]\n    ans += sum(T[P[i]:])\n    print(ans)\n", "passed": true, "time": 0.14, "memory": 14108.0, "status": "done"}, {"code": "N = int(input())\nT = list(map(int,input().split()))\n\nt_sum = sum(T)\n\nM = int(input())\nfor _ in range(M):\n  P,X = map(int,input().split())\n  print(t_sum - (T[P-1] - X))", "passed": true, "time": 0.14, "memory": 14212.0, "status": "done"}, {"code": "N = int(input())\nT = list(map(int, input().split()))\nM = int(input())\nfor n in range(M):\n    P, X = map(int, input().split())\n    T_copied = T.copy()\n    T_copied[P-1] = X\n    print(sum(T_copied))", "passed": true, "time": 0.14, "memory": 14080.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int,input().split()))\nm = int(input())\na,b = 0,0\nfor _ in range(m):\n  a,b = map(int,input().split())\n  print(sum(t) - t[a-1] + b)", "passed": true, "time": 0.16, "memory": 14272.0, "status": "done"}, {"code": "n = int(input())\nt = tuple(map(int,input().split()))\nm = int(input())\nx = [list(map(int,input().split())) for _ in range(m)]\n\ni = 0\nfor x[i] in x:\n    l = list(t)\n    j = x[i][0] - 1 #\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\n    k = x[i][1]     #\u7f6e\u63db\u5143\n    i += i\n    l[j] = k\n    print(sum(l))", "passed": true, "time": 0.14, "memory": 14076.0, "status": "done"}, {"code": "n = int(input())\nt = [int(i) for i in input().split()] #\u5206\u5272\u3057\u305f\u6587\u5b57\u5217\u3092\u9806\u7e70\u308a\u306bint\u306b\u5909\u63db\u3057\u3066\u30ea\u30b9\u30c8\u306b\u8ffd\u52a0\nm = int(input())\n\nfor i in range(m):\n    sum = 0\n    count = 1\n    p, x = list(map(int, input().split()))\n    for j in t:\n        if(p == count):\n            sum += x\n        else:\n            sum += j\n        count += 1\n    print(sum)\n", "passed": true, "time": 0.15, "memory": 14140.0, "status": "done"}, {"code": "n = int(input())\nt = [int(s) for s in input().split()]\nm = int(input())\ntotal = sum(t)\nans = []\nfor i in range(m):\n    p, x = map(int, input().split())\n    ans.append(total - t[p - 1] + x)\n\nfor a in ans:\n    print(a)", "passed": true, "time": 0.14, "memory": 14284.0, "status": "done"}, {"code": "a=int(input())\nb=list(map(int,input().split()))\nc=int(input())\nd=[]\nfor i in range(c):\n  d.append(list(map(int,input().split())))\n\nfor i in range(c):\n  f=b.copy()\n  p=d[i][0]-1\n  f[p]=d[i][1]\n  print((sum(f)))\n", "passed": true, "time": 0.14, "memory": 14084.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int, input().split()))\nst = sum(t)\nm = int(input())\nfor i in range(m):\n    p, x = list(map(int, input().split()))\n    print((st - t[p - 1] + x))\n", "passed": true, "time": 0.14, "memory": 14360.0, "status": "done"}, {"code": "import copy\nn = int(input())\nT = list(map(int,input().split()))\nm = int(input())\n\nfor _ in range(m):\n  A = copy.copy(T)\n  a,b = map(int,input().split())\n  A[a-1] = b\n  print(sum(A))", "passed": true, "time": 0.14, "memory": 14048.0, "status": "done"}, {"code": "# N\u554f\u306e\u554f\u984c\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b\nN = int(input())\n# \u554f\u984c\u3092\u89e3\u304f\u306e\u306b\u304b\u304b\u308b\u6642\u9593\nT = list(map(int, input().split()))\n\n# \u30c9\u30ea\u30f3\u30af\u306e\u7a2e\u985eM\nM = int(input())\n# \u30c9\u30ea\u30f3\u30af\u3092\u98f2\u3093\u3060\u5834\u5408\u306e\u6642\u9593\u3092\u30ea\u30b9\u30c8\u306b\u683c\u7d0d\u3059\u308b\nX = []\n\n# \u307e\u305a\u306f\u30c9\u30ea\u30f3\u30af\u3092\u98f2\u3093\u3060\u5834\u5408\u306e\u6642\u9593\u3092X\u306b\u683c\u7d0d\u3059\u308b\nfor i in range(M):\n    X.append(list(map(int,input().split())))\n    X[i][0] = X[i][0]-1\n\nY = []\n# \u305d\u308c\u305e\u308c\u306e\u554f\u984c\u306e\u89e3\u304f\u6642\u9593\u3092\u53d6\u5f97\u3059\u308b\nfor i in range(N):\n    Y.append(T[i])\n    \nfor i in range(len(X)):\n    Y_copy = Y.copy()\n    Y_copy[X[i][0]] = X[i][1]\n    print(sum(Y_copy))", "passed": true, "time": 0.14, "memory": 14260.0, "status": "done"}, {"code": "n = int(input())\np = list(map(int, input().split()))\nk = int(input())\nfor i in range(k):\n  a, b = list(map(int, input().split()))\n  c = p[a-1]\n  p[a-1] = b\n  print((sum(p)))\n  p[a-1] = c\n", "passed": true, "time": 0.14, "memory": 14136.0, "status": "done"}, {"code": "quiznum=int(input())\ntimeline=input().split(\" \")\ntimeline=[int(n) for n in timeline]\n#print(timeline)\ntime_0=0\nfor i in range(quiznum):\n    time_0+=timeline[i]\n#print(time_0)\n\nmedinum=int(input())\nfor i in range(medinum):\n    temp_line=input().split(\" \")\n    a=int(temp_line[0])\n    b=int(temp_line[1])\n    time=time_0 - timeline[a-1] + b\n    print(time)", "passed": true, "time": 0.14, "memory": 14128.0, "status": "done"}, {"code": "n = int(input())\nts = list(map(int, input().split()))\nm = int(input())\nfor i in range(m):\n  p, x = map(int, input().split())\n  print(sum(ts) - ts[p-1] + x)", "passed": true, "time": 0.14, "memory": 14256.0, "status": "done"}, {"code": "n=int(input())\nt=list(map(int,input().split()))\nm=int(input())\nfor i in range(m):\n    p,x=map(int,input().split())\n    print(sum(t)-(t[p-1]-x))", "passed": true, "time": 0.14, "memory": 14220.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int, input().split()))\nm = int(input())\n\nfor i in range(m):\n  p,x = list(map(int, input().split()))\n  print((sum(t) - t[p-1] + x))\n", "passed": true, "time": 0.19, "memory": 14216.0, "status": "done"}, {"code": "#-*-coding:utf-8-*-\nimport sys\ninput=sys.stdin.readline\nimport copy\n\ndef main():\n    questions=[]\n    dp=[]\n    n = int(input())\n    questions=list(map(int,input().split()))\n    m = int(input())\n    drinks=[list(map(int,input().split())) for _ in range(m)]\n    for drink in drinks:\n        dp=copy.deepcopy(questions)\n        dp[drink[0]-1]=drink[1]\n        print(sum(dp))\n    \ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.15, "memory": 14124.0, "status": "done"}, {"code": "n = int(input())\nt = [0] + list(map(int, input().split()))\ns = sum(t)\nm = int(input())\nfor _ in range(m):\n    p,x = list(map(int, input().split()))\n    print((s - t[p] + x))\n", "passed": true, "time": 0.14, "memory": 14140.0, "status": "done"}, {"code": "N = int(input())\nT = list(map(int, input().split()))\nM = int(input())\nP, X = [0] * M, [0] * M\nfor i in range(M):\n    P[i], X[i] = map(int, input().split())\n\nfor i in range(M):\n    t_sum = X[i]\n    for j in range(N):\n        if j == P[i] - 1:\n            continue\n        t_sum += T[j]\n    print(t_sum)", "passed": true, "time": 0.17, "memory": 14164.0, "status": "done"}, {"code": "n=int(input())\ntl=list(map(int,input().split()))\nm=int(input())\npxl=[list(map(int,input().split())) for _ in range(m)]\ns=sum(tl)\nfor p,x in pxl:\n    print((s-tl[p-1]+x))\n", "passed": true, "time": 0.52, "memory": 14076.0, "status": "done"}, {"code": "n=int(input())\nt=list(map(int,input().split()))\nfor _ in range(int(input())):\n    p,x=map(int,input().split())\n    ans=0\n    for i in range(n):\n        if p-1==i:\n            ans+=x\n        else:\n            ans+=t[i]\n    print(ans)", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "n=int(input())\nt=list(map(int,input().split()))\nm=int(input())\nfor i in range(m):\n  p,x=map(int,input().split())\n  y=t[p-1]\n  t[p-1]=x\n  print(sum(t))\n  t[p-1]=y", "passed": true, "time": 0.22, "memory": 14196.0, "status": "done"}, {"code": "input();t=[*map(int,input().split())];T=sum(t)\nprint(*[T-t[i-1]+j for i,j in [[*map(int,input().split())] for _ in range(int(input()))]],sep='\\n')", "passed": true, "time": 0.15, "memory": 14264.0, "status": "done"}, {"code": "N = int(input())\nT = list(map(int, input().split()))\nM = int(input())\nfor i in range(M):\n  p, x = list(map(int, input().split()))\n  s = sum(T) - T[p-1] + x\n  print(s)\n  \n", "passed": true, "time": 0.15, "memory": 14328.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int, input().split()))\nm = int(input())\nfor i in range(m):\n  p, x = map(int, input().split())\n  s = t[p-1]\n  t[p-1] = x\n  print(sum(t))\n  t[p-1] = s", "passed": true, "time": 0.22, "memory": 14192.0, "status": "done"}, {"code": "N = int(input())\nT = list(map(int, input().split()))\nans = sum(T)\nM = int(input())\nfor i in range(M):\n  P, X = map(int, input().split())\n  print(ans - T[P-1] + X)", "passed": true, "time": 0.18, "memory": 14304.0, "status": "done"}, {"code": "N=int(input())\nT=list(map(int,input().split()))\nM=int(input())\ndrink=[]\nfor i in range(M):\n    P,X=map(int,input().split())\n    drink.append([P,X])\n    \nfor j in range(len(drink)):\n    P,X=drink[j]\n    time=X+sum(T)-T[P-1]\n    print(time)", "passed": true, "time": 0.16, "memory": 14076.0, "status": "done"}, {"code": "import copy\n\nn = int(input())\nt = [int(x) for x in input().split()]\nm = int(input())\np = []\nfor i in range(m):\n  p.append([int(x) for x in input().split()])\n\nfor i in range(m):\n  r = copy.copy(t)\n  r[p[i][0]-1] = p[i][1]\n  print(sum(r))", "passed": true, "time": 0.14, "memory": 14300.0, "status": "done"}, {"code": "import copy\nn=int(input())\nt=list(map(int,input().split()))\nm=int(input())\nfor i in range(m):\n    a,b=map(int,input().split())\n    total=copy.copy(t)\n    total[a-1]=b\n    print(sum(total))", "passed": true, "time": 0.14, "memory": 14268.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int,input().split()))\nm = int(input())\nfor i in range(m):\n  p,x = list(map(int,input().split()))\n  save = t[p-1]\n  t[p-1] = x\n  print((sum(t)))\n  t[p-1] = save\n", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "n=int(input())\nt =list(map(int, input().split()))\nm=int(input())\nfor i in range(m):\n    p,x=map(int,input().split())\n    q = sum(t) - (t[p-1] - x)\n    print(q)", "passed": true, "time": 0.16, "memory": 14116.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int, input().split()))\nm = int(input())\nfor i in range(m):\n    p, x = map(int, input().split())\n    print(sum(t) - t[p-1] + x)", "passed": true, "time": 0.22, "memory": 14212.0, "status": "done"}, {"code": "N=int(input())#\u554f\u984c\u306e\u6570\nT=list(map(int,input().split()))#\u554f\u984c\u3092\u89e3\u304f\u306e\u306b\u304b\u304b\u308b\u6642\u9593\nM=int(input())#\u30c9\u30ea\u30f3\u30af\u306e\u7a2e\u985e\u306e\u6570\nfor i in range(1,M+1):\n    tmp=list(map(int,input().split()))\n    tmp2=T[tmp[0]-1]\n    T[tmp[0]-1]=tmp[1]\n    print(sum(T))\n    T[tmp[0]-1]=tmp2", "passed": true, "time": 0.14, "memory": 14204.0, "status": "done"}, {"code": "N = int(input())\nT = list(map(int, input().split()))\nsumT = sum(T)\nM = int(input())\nfor i in range(M):\n  P, X = map(int, input().split())\n  ans = sumT-T[P-1]+X\n  print(ans)", "passed": true, "time": 0.14, "memory": 14084.0, "status": "done"}, {"code": "N = int(input())\nT = input().split()\nM = int(input())\n\nfor i in range(N):\n   T[i] = int(T[i])\n\nS = sum(T)\n\nfor i in range(M):\n   l = input().split()\n   print(S - (T[int(l[0]) - 1] - int(l[1])))", "passed": true, "time": 0.14, "memory": 14152.0, "status": "done"}, {"code": "N = int(input())\nT = list(map(int, input().split()))\nM = int(input())\nL = []\nres = []\nfor i in range(M):\n    P, X = list(map(int, input().split()))\n    buf = []\n    for j in range(len(T)):\n        if P == j+1:\n            buf.append(X)\n        else:\n            buf.append(T[j])\n    res.append(sum(buf))\n\nfor i in res:\n    print(i)\n", "passed": true, "time": 0.14, "memory": 14260.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int, input().split()))\nm = int(input())\na = []\nfor _ in range(m):\n    p, x = map(int, input().split())\n    u = t[:]\n    u[p - 1] = x\n    a.append(sum(u))\nfor i in range(m):\n    print(a[i])", "passed": true, "time": 0.14, "memory": 14272.0, "status": "done"}, {"code": "n=int(input())\nt=list(map(int,input().split()))\nm=int(input())\npx=[]\nfor _ in range(m):\n  p,x=map(int,input().split())\n  px.append((p-1,x))\nfor i in range(m):\n  ans=0\n  p,x=px[i]\n  for j in range(n):\n    if j==p:\n      ans+=x\n    else:\n      ans+=t[j]\n  print(ans)", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "n,t=int(input()),list(map(int,input().split()));T=sum(t)\nprint(*[T-t[i-1]+j for i,j in [list(map(int,input().split())) for _ in range(int(input()))]],sep='\\n')", "passed": true, "time": 0.14, "memory": 14052.0, "status": "done"}, {"code": "n = input()\nt_raw = list(map(int, input().split()))\nm = int(input())\nfor _ in range(m):\n    t = t_raw.copy()\n    p, x = map(int, input().split())\n    t[p-1] = x\n    print(sum(t))", "passed": true, "time": 0.15, "memory": 14068.0, "status": "done"}, {"code": "N = int(input())\n*T, = map(int, input().split())\nM = int(input())\npx = [list(map(int, input().split())) for _ in range(M)]\n\nfor i in range(M):\n    pi = px[i][0] - 1\n    print(sum(T) - T[pi] + px[i][1])", "passed": true, "time": 0.14, "memory": 14252.0, "status": "done"}, {"code": "N = int(input())\ntimes = list(map(int,input().split()))\nM = int(input())\ndrinks = []\nfor _ in range(M):\n    drinks.append(list(map(int,input().split())))\n\nfor drink in drinks:\n    total = 0\n    for j in range(N):\n        if drink[0] == j+1:\n            total += drink[1]\n        else:\n            total += times[j]\n    print(total)", "passed": true, "time": 0.14, "memory": 14292.0, "status": "done"}, {"code": "n=int(input())\nt=list(map(int,input().split()))\nm=int(input())\ns=sum(t)\nfor i in range(m):\n  p,x=map(int,input().split())\n  print(s+x-t[p-1])", "passed": true, "time": 0.14, "memory": 14216.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int, input().split()))\nm = int(input())\ndrink = [list(map(int, input().split())) for _ in range(m)]\nfor p, x in drink:\n    print((sum(t) - t[p - 1] + x))\n", "passed": true, "time": 0.23, "memory": 14124.0, "status": "done"}, {"code": "N = int(input())\nT = list(map(int, input().split()))\nM = int(input())\nL = []\nfor _ in range(M):\n    p, x = list(map(int, input().split()))\n    L.append([p, x])\n\nfor i in range(M):\n    sum_num = 0\n    for j in range(N):\n        if L[i][0] - 1 == j:\n            sum_num += L[i][1]\n        else:\n            sum_num += T[j]\n    print(sum_num)\n", "passed": true, "time": 0.22, "memory": 14232.0, "status": "done"}, {"code": "N = int(input())\nT = list(map(int,input().split()))\nM =int(input())\npx = [list(map(int,input().split())) for i in range(M)]\n\nsumTime = sum(T)\n\nfor i in range(M):\n    print(sumTime-T[px[i][0]-1]+px[i][1])", "passed": true, "time": 0.24, "memory": 14220.0, "status": "done"}, {"code": "n = int(input())\ntimeList = list(map(int, input().split()))\nm = int(input())\nargList = [list(map(int, input().split())) for _ in range(m)]\n\n#\u666e\u901a\u306b\u3084\u308b\u3068\nres_time = sum(timeList)\n\nfor a in argList:\n\n    #a[0]\u554f\u76ee\u3092\u89e3\u304f\u306e\u306b\u3000a[1]\u79d2\u304b\u304b\u308b\u3088\n    print((res_time - timeList[a[0]-1] + a[1]))\n\n", "passed": true, "time": 0.14, "memory": 14232.0, "status": "done"}, {"code": "n = int(input())\n\nt = list(map(int,input().split()))\n\nm = int(input())\n\nfor i in range(m):\n\tp,x = list(map(int,input().split()))\n\ttmpt = t[p-1] \n\tt[p-1] = x\n\tprint((sum(t)))\n\tt[p-1] = tmpt\n\t\n", "passed": true, "time": 0.14, "memory": 14248.0, "status": "done"}, {"code": "N = int(input())\nli = list(map(int, input().split()))\nM = int(input())\nan = sum(li)\nfor i in range(M):\n    p,x = map(int, input().split())\n    h = x - li[p-1]\n    print(sum(li) + h)", "passed": true, "time": 0.14, "memory": 14196.0, "status": "done"}, {"code": "N=int(input())\nT=list(map(int,input().split()))\nM=int(input())\nx=sum(T)\nfor _ in range(M):\n    P,X=list(map(int,input().split()))\n    print((x+X-T[P-1]))\n", "passed": true, "time": 0.14, "memory": 14116.0, "status": "done"}, {"code": "import sys, math\nfrom itertools import combinations as c, product as p\nfrom collections import deque\nsys.setrecursionlimit(10**9)\n\n\ndef si(): return input()\ndef ii(): return int(input())\ndef fi(): return float(input())\ndef lstr(): return input().split()\ndef lint(): return list(map(int, input().split()))\ndef lint_dec(): return list(map(lambda x:int(x) - 1, input().split()))\ndef lnstr(n): return [input() for _ in range(n)]\ndef lnint(n): return [int(input()) for _ in range(n)]\ndef lint_list(n): return [lint() for _ in range(n)]\n\n\n\n############################################################\nN = ii()\nT = lint()\nM = ii()\ntotal = sum(T)\n\nfor _ in range(M):\n    P, X = lint()\n    print(total - T[P - 1] + X)", "passed": true, "time": 0.45, "memory": 14196.0, "status": "done"}, {"code": "n = int(input())\nt_l = list(map(int, input().split()))\nm = int(input())\nimport copy\nfor _ in range(m):\n    k, v = map(int, input().split())\n    tmp_t = copy.deepcopy(t_l)\n    tmp_t[k-1] = v\n    print(sum(tmp_t))", "passed": true, "time": 0.15, "memory": 14048.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int,input().split()))\nm = int(input())\npx = [list(map(int,input().split())) for _ in range(m)]\nfor i in px:\n    print((sum(t) - t[i[0]-1] + i[1]))\n", "passed": true, "time": 0.14, "memory": 14120.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int,input().split()))\nm = int(input())\nfor i in range(m):\n    a,b = map(int,input().split())\n    T = sum(t) - t[a-1] + b\n    print(T)", "passed": true, "time": 0.14, "memory": 14112.0, "status": "done"}, {"code": "N = int(input())\nT = list(map(int,input().split()))\nM = int(input())\nans = sum(T)\ncopy = ans\nfor i in range(M):\n    p,x = list(map(int,input().split()))\n    p -= 1\n    ans -= T[p]\n    ans += x\n    print(ans)\n    ans = copy\n\n    \n", "passed": true, "time": 0.14, "memory": 14272.0, "status": "done"}, {"code": "N = int(input())\n\nT = list(map(int, input().split()))\nM = int(input())\n\nfor _ in range(M):\n    p, x = tuple(map(int, input().split()))\n    tmp_num = T[p-1]\n    T[p-1] = x\n    print(sum(T))\n    T[p-1] = tmp_num", "passed": true, "time": 0.14, "memory": 14088.0, "status": "done"}, {"code": "N = int(input())\nT = list(map(int,input().split()))\nsum = 0\nfor _ in range(N):\n  sum += T[_]  \nM = int(input())\nfor i in range(M):\n  a,b = list(map(int,input().split()))\n  print((sum + b - T[a - 1]))\n  \n", "passed": true, "time": 0.14, "memory": 14116.0, "status": "done"}, {"code": "n = int(input())\nt = list(map(int,input().split()))\ns = sum(t)\nm = int(input())\nfor i in range(m):\n    p,x = map(int,input().split())\n    print(s+(x-t[p-1]))", "passed": true, "time": 0.14, "memory": 14084.0, "status": "done"}, {"code": "from typing import List\n\n\ndef answer(n: int, t: List[int], m: int, pxs: List[List[int]]) -> str:\n    result = []\n    for px in pxs:\n        t_copy = t.copy()\n        t_copy[px[0] - 1] = px[1]\n        result.append(str(sum(t_copy)))\n\n    return '\\n'.join(result)\n\n\ndef main():\n    n = int(input())\n    t = list(map(int, input().split()))\n    m = int(input())\n    pxs = [list(map(int, input().split())) for _ in range(m)]\n    print((answer(n, t, m, pxs)))\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.15, "memory": 15156.0, "status": "done"}, {"code": "n = int(input())\nT = list(map(int, input().split()))\nm = int(input())\nD = [tuple(map(int, input().split())) for _ in range(m)]\n\nsum_T = sum(T)\nfor i in range(m):\n    print((sum_T - T[D[i][0] - 1] + D[i][1]))\n", "passed": true, "time": 0.14, "memory": 14044.0, "status": "done"}]