680. Chess Knight Problem

0

Medium

You enjoy playing Chess and are tasked with finding the shortest distance a knight can travel from a given source to a given destination on a chessboard.

Input Format

The first line contains the coordinates of the source point, x1 and y1, separated by a space. The second line contains the coordinates of the destination point, x2 and y2, also separated by a space.

Output Format

Print the minimum number of steps taken by the knight to reach the destination from the given source.

Example

Input

0 7
7 0

Output

6

Constraints

0 <= x1, y1, x2, y2 <= 7

Loading...

View Submissions

Console