#最小公倍数でループ
import math
n = int(input())
ans = list(map(int,input().split()))
lcm = ans[0]
for k in ans:
    gcd = math.gcd(lcm, k)
    lcm = round(lcm*k/gcd)
    print(lcm)


an =0
for k in ans:
    an += (lcm-1)%k
        
print(an)