n = input() a = map(int,input().split(" ")) v = int(input()) ans = sum(a) print(ans - v)