n=int(input())

a=list(int(i) for i in input().split())

v=int(input())

sum=0
for i in range(len(a)):
    sum+=a[i]

print(sum-v)