import strutils, sequtils, math discard stdin.readline echo(stdin.readline.split.map(parseInt).sum - stdin.readline.parseInt)