Solved UVa 540