Four friends are playing table tennis. Each of them has a skill level which is represented by an integer number: the higher the number, the better the player is.

The four friends want to form two teams of two players each. For the game to be more exciting, they want the skill level of the teams to be as close as possible. The skill level of a team is the sum of the skill levels of the players in that team.

Although they are very good table tennis players, these friends are not so good at other things, like Math or Computing. Can you help them find the smallest possible difference between the teams' skill levels?

Four integers $A$, $B$, $C$ and $D$, representing the skill levels of the four players ($0 \leq A \leq B \leq C \leq D \leq 10^4$).

The smallest difference between the skill levels for both teams.

Input

4 7 10 20

Output

7

Input

0 0 1 1000

Output

999

Input

1 2 3 4

Output

0