Casting
In theater n actors are working. It is known that among them there are a tall, b blue-eyed and c blond. For the main role in a new performance director requires only one high blue-eyed blond. To plan the time to talk with each such actor from theater troupe, the director needs to know what is the maximum or the minimum number of artists working in the theater appropriate for the role.
Given the numbers n, a, b and c, define the minimum and maximum number of artists with whom the director should talk.
Input
The first line contains a number that specifies the minimum or maximum number of actors need to find in this test. This number could take the following values:
1, if in this test required to determine the minimum number of actors;
2, if in this test required to determine the maximum number of actors.
Second line contains four integers: n, a, b, с (1 ≤ n ≤ 10000, 0 ≤ a, b, c ≤ n).
Output
Print one number - the minimum or maximum (depending on the input data) number of actors who can claim a major role in the new play.
Examples
Note
In the first example, since we have 3 high actors, the main role can not go to more than three people.
In the second example all actors are blond and all but one are blue-eyed. Then, among the three highest actors there are at least two blue-eyed (and, naturally, they are blond). Consequently, at least two actors exactly suited for the leading role in a new play.