# ABC103C - Modulo Summation

from fractions import gcd





def lcm(a, b):

    return (a * b) // gcd(a, b)





n = int(eval(input()))

lst = list(map(int, input().rstrip().split()))

ans = 0

f = lcm(lst[0], lst[1])

for i in range(n):

    f = lcm(f, lst[i])

f -= 1

for i in lst:

    ans += f % i

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

lst = list(map(int, input().rstrip().split()))

ans = 0

for i in lst:

    ans += i - 1

print(ans)
# ABC103C - Modulo Summation
from fractions import gcd


def lcm(a, b):
    return (a * b) // gcd(a, b)


n = int(eval(input()))
lst = list(map(int, input().rstrip().split()))
ans = 0
f = lcm(lst[0], lst[1])
for i in range(n):
    f = lcm(f, lst[i])
f -= 1
for i in lst:
    ans += f % i
print(ans)

n = int(eval(input()))
lst = list(map(int, input().rstrip().split()))
ans = 0
for i in lst:
    ans += i - 1
print(ans)

-# ABC103C - Modulo Summation -from fractions import gcd - - -def lcm(a, b): -    return (a * b) // gcd(a, b) - - -f = lcm(lst[0], lst[1]) -for i in range(n): -    f = lcm(f, lst[i]) -f -= 1 -    ans += f % i +    ans += i - 1