UVa problem 458