import numpy as np

def main():
  n = int(input())
  a = np.array(list(map(int, input().split())))
  q = int(input())
  
  al = len(a)
  b = []
  c = []
  for _ in range(q):
    bi, ci = map(int, input().split())
    b.append(bi)
    c.append(ci)
    d = b + c
    a_in_not = [i for i in a if i not in d]
    print(sum(a_in_not) + ci * (al - len(a_in_not)))
 
main()
