Solved UVa 541