def solve(): N = int(input()) A = list(map(int, input().split())) V = int(input()) print(sum(A) - V) if __name__ == '__main__': solve()