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