Skip to main content
LIVE CONTEST: Round #7 · Begin Marathon is live now! …

~/algor $ cat problems/if/how-many-moves-for-the-bishop

How many moves for the bishop?

Author Iqbolshoh Ilhomjonov 3 @iqbolshoh 650 problems
Medium 1000 ms 64 MB 45%
Share

Two different squares of a chessboard are given: a bishop stands on . Determine the smallest number of moves the bishop needs to reach . If it cannot get there, print .

A bishop's moves to the given square on a chessboard

Input

One line with four integers: , , and .

Output

One integer: the smallest number of moves, or .

Note


The squares are different.

Examples

Input #1
3 1 6 4
Output #1
1
Input #2
3 1 3 5
Output #2
2

Sign in to submit a solution

Signing up is free and takes a minute.