KNIGHT
You are given a chessboard with dimensions
Input
The first line of the input contains two integers
Output
The output should consist of a single line containing exactly one integer: the minimum number of moves required to bring the knight from the bottom-left to the top-right corner of the chessboard.
Constraints
Execution time limit: 1 sec.
Memory limit: 128 MB.
Examples of Input - Output
1st
STDIN (knight.in)
5 6
STDOUT (knight.out)
3
2nd
STDIN (knight.in)
8 8
STDOUT (knight.out)
6
Comments