Solved UVa 11586