LCC '23 Contest 3 J1 - Christmas Dinner

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type

It's Christmas Eve, and Anna and Elsa are making dinner for their N friends! They want to surprise everybody with their favourite holiday dish: Christmas pudding, but they don't know how many to make. Anna knows that A of their friends will eat a_i Christmas puddings, while Elsa knows that the rest will eat b_i Christmas puddings. Can you help them?


1 \le N, a_i, b_i \le 4 \times 10^4

 1 \le A \le N

Input Specification

The first and only line will contain integers N, A, a_i, and b_i.

Output Specification

Output the number of Christmas puddings Anna and Elsa need to make.

Sample Input

10 4 2 3

Sample Output



There are no comments at the moment.