m = int(input())
costs = list(map(int, input().split()))

n, e = map(int, input().split())

ans = [0]*n
belt = [0] * (n+1)

chef_time = 0
chef_ind = 0

for _ in range(e):
    t, x = map(int, input().split())
    while chef_time < t:
        if not belt[0]:
            belt[0] = costs[chef_ind%m]
            chef_ind += 1
        chef_time += 1
        belt = belt[1:] + belt[:1]
    ans[x-1] += belt[x]
    belt[x] = 0

print(*ans,sep='\n')
