UVa - problem 108