a = gets.to_i b = gets.split.map(&:to_i) c = gets.to_i d = b.inject(:+) e = d - c puts e