Solved UVa 318