Solved UVa 11857