http://www.spoj.com/problems/CPCRC1C/