input() l = list(map(int, input().split())) v = int(input()) print(sum(l) - v)