Solved UVa 10260.