LCC '22 Contest 3 J1 - Water You Doing?

View as PDF

Submit solution

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

Author:
Problem type

It's the middle of December, so Daniel is preparing for a relaxing summer! (Hey, it's summer somewhere in the world). He's planning on taking a 2-week vacation to spend some time with his friends and family, and to take his mind off work.

Daniel wants to invite all of his N friends over for a secret santa. Unfortunately, some of his friends are out of town, with plans to go to the beach and amusement park.

A friends have plans to go to the beach, B friends have plans to go to the amusement park, and C of the friends going to either one of the beach or amusement park have plans to go to both.

How many friends can Daniel invite?

Constraints

1 \le N \le 10^9

C \le A+B

Input Specification

The first and only line of input contains four integers, N, A, B, and C.

Output Specification

Output one integer, the number of friends that are in town with no plans.

Sample Input

9 3 2 1

Sample Ouput

5

Comments

There are no comments at the moment.