import sys from maze import parse_maze m = parse_maze(sys.stdin.read()) print m.solve()