Knight and Pawn#32

Knight and Pawn

1 second
64 megabytes
Medium
prb32

There is a well-known problem called "Bishop and Pawn" on a popular website.

We offer you a similar game, involving a white pawn and a black knight. Moves are made according to the standard chess rules. White plays first.

White wins if the pawn is promoted, and on the next turn the black knight cannot capture the promoted piece. If it is White's move and the pawn cannot advance, the game is a draw. If the knight captures the pawn or the promoted piece, Black wins.

Determine the result of the game assuming both sides play optimally.

Input

A single line contains the positions of the white pawn and the black knight, separated by a space (written in chess notation, but without specifying the piece type).

Output

Print 1 if White wins, -1 if Black wins, and 0.5 if the game is a draw.

Examples

Example 1

Loading
Loading