solution to p83; thanks dijkstra