Hide

Problem G
Skák

Languages en is
/problems/skak/file/statement/en/img-0001.png
Skák

Petra and Garðar are playing chess on an infinitely large chessboard. In this strange version of chess they each start with a million pieces in the game. The game isn’t over until one player removes all of their opponent’s pieces.

As you might imagine this version of chess takes quite a while per game. Petra and Garðar have been playing the game for over a week without any breaks.

The only pieces left is a single pawn on Garðar’s side and one rook on Petra’s side. Garðar is also so tired he claims he won’t move his pawn anymore. Petra is almost as tired and just wants to end the game in the fewest moves possible. But since she’s been playing for so long she can barely think.

Can you help Petra and tell her what the minimum number of moves needed is to end the game?

Input

The input is on two lines. The first line contains two integers $1 \le x_h, y_h \le 10^5$, the location of Petra’s rook. The second line contains two integers $1 \le x_p, y_p \le 10^5$, the location of Garðar’s pawn.

It is guaranteed that these locations are not the same.

Output

Print a single line, the minimum number of moves Petra needs to finish the game.

Scoring

Group

Points

Constraints

1

100

No further constraints

Sample Input 1 Sample Output 1
3 3
1 1
2
Sample Input 2 Sample Output 2
5 100
5 200
1