UVa Problem 291