http://www.codechef.com/MARCH09/problems/A1