favorite We need a little bit of your help to keep things running, click on this banner to learn more

School Olympiad

School Olympiad

At school programming contest the participants were asked to solve two problems. a students totally coped with the given tasks, and b students solve nothing.

How many participants were in competition if there was accepted c correct submitions for the first task, and d submitions for the second task.


Nonnegative integers a, b, c и d, not greater than 100.


Number of participants at school programming contest.

Time limit 1 second
Memory limit 64 MiB
Input example #1
1 2 3 4
Output example #1