eolymp
bolt
Try our new interface for solving problems
Problems

Knight and pawn

Knight and pawn

Time limit 1 second
Memory limit 64 MiB

There is a problem called “Bishop and pawn” on a famous and popular site http://acm.timus.ru.

We offer you a similar game, in which a white pawn plays against a black knight. They move according the usual chess rules. Whites moves first. In this game white wins, if it can turn their pawn in a queen and during the following move black knight can’t destroy the queen. The game finishs in a draw, if pawn can’t move during it's turn. The black wins it the knight beats the pawn or a queen. You must elucidate the outcome (result) of the game given each player applies the best strategy.

Input data

In first line you are given position of the white pawn and the black knight separated by a space in chess notation.

Output data

Print 1 – if white wins, print -1 – if black wins and 0.5 – if the game will finish draw.

Examples

Input example #1
g3 a1
Output example #1
-1