n=eval(input())

A=list(map(int,input().split()))

t=1

for a in A:

    t *= a

t -= 1

ans=0

for a in A:

    ans += t % a

print(ans)
n=eval(input())

A=list(map(int,input().split()))

for i in range(int(n)):

    A[i] -=1

print((sum(A)))
n = eval(input())
A = list(map(int, input().split()))
t = 1
for a in A:
    t *= a
t -= 1
ans = 0
for a in A:
    ans += t % a
print(ans)

n = eval(input())
A = list(map(int, input().split()))
for i in range(int(n)):
    A[i] -= 1
print((sum(A)))

-t = 1 -for a in A: -    t *= a -t -= 1 -ans = 0 -for a in A: -    ans += t % a -print(ans) +for i in range(int(n)): +    A[i] -= 1 +print((sum(A)))