UVa 10440 using a Dijkstra search on state space