def main(): N = int(input()) A = tuple(map(int, input().split())) V = int(input()) ans = sum(A) - V print(ans) main()