Processing the coins in the right order is important in problem-31