#t448. 最小步数

最小步数

Two Horses

Problem Description

In board games a piece always moves in a fixed way; for example, in Chinese chess the horse moves in the 日 shape. A schoolboy wondered whether the game would be more fun if the horse had two kinds of moves. So he ruled that the horse may move either in the 日 shape or, like the elephant, in the 田 shape.

His desk-mate, who likes Go, found this interesting and decided to try it on a 100×100100 \times 100 Go board. Choose two points AA and BB; put a black stone at AA and a white stone at BB, representing the two horses. A piece may move in either the 日 or the 田 shape. One player moves the black horse, the other moves the white horse. Whoever reaches the upper-left corner (1,1)(1,1) in the fewest moves wins.

Given the coordinates of AA and BB, find the minimum number of moves each horse needs to reach (1,1)(1,1).

Input Format

The coordinates of points AA and BB.

Output Format

The minimum number of moves for each horse.

Sample Input

12 16
18 10

Sample Output

8
9

Limitation

1 s, 1024 KiB for each test case.