Problem 10267 from UVa Online Judge (http://uva.onlinejudge.org/)