POJ2005 Simple math with careful dealings with special cases. RANK:16816