시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 1 1 1 100.000%

문제

The size of a right-angled cell board is n*m cells. The chess knight is located in the left bottom cell of the board (coordinates 1;1), as shown in pic.1.

The chess knight can move according to the chess rules - during each turn it can move according to the chess rules- either one cell in the vertical direction and one in horizontal or vice versa.

Thus, for example, if n=4 and m=3 and the knight is located in the cell (2;1) (see pic.2), then with the next turn it can move in any of the following cells : (1;3),(3;3) or (4;2).

For the given natural numbers n,m,i,j (n<=100,m<=100,i<=n,j<=m) given in the input your task is to determine and output, which is the least possible number of moves for the knight to reach the cell (i;j), starting from the cell (1;1).

If it is not possible to reach this cell, output one single word "NEVAR".

Pic. 1

Pic. 2

예제 입력 1

5 3 1 2

예제 출력 1

3

예제 입력 2

100 2 2 2

예제 출력 2

NEVAR