$ 0 0 Q) http://www.codechef.com/MAY14/problems/CHEFBM my solution :-http://www.codechef.com/viewsolution/3896589