Solved UVa 10508