Solve UVa 10608