package yukicoder; import java.io.BufferedReader; import java.io.InputStreamReader; public class No369TashiMachigai { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int times = Integer.parseInt(br.readLine()); String[] nums = br.readLine().split(" "); int num = 0; for(int i = 0; i < nums.length; i++) { num += Integer.parseInt(nums[i]); } int ans = num - Integer.parseInt(br.readLine()); System.out.println(ans); } }