Solved UVa 1112