e-olymp
Problems

Queen and pawn

Queen and pawn

prb32 On famous and popular site we have a problem “Elephant and pawn ” => http://acm.timus.ru.

We propose to You a similar game, in which take place white pawn and black horse. Moves are made in accordance with the usual chess rules. Whites moves first. Whites wins, if they could transformation their pawn in queen and next move by black horse can’t destroy queen. The game is finish draw, if turn of moves for whitening, but pawn can’t move on. If the horse could beat the pawn or queen, than win blacks. You must elucidate a outcome (result) of game with the best playing from each others.

Input

In one line through the gaps we have a start position of white pawn, and black horse (in chess notation, but without figure).

Output

Make clear 1 – if will win whites, make clear -1 – if will win blacks and 0.5 – if the game will finish draw.

Time limit 1 second
Memory limit 64 MiB
Input example #1
g3 a1
Output example #1
-1