A solution to POJ 1799, a very simple problem.