# coding=utf-8: n = int(input()) numList = list(map(int, input().split())) yAns = int(input()) total = 0 for i in numList: total += i ans = total - yAns print(ans)