N = int(input()) f = input() s_f = f.split() a = [int(v) for v in s_f] v = int(input()) c = 0 for i in range(0, N): c += a[i] #print(c) print(c - v)