use dijkstra to get to firs position