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