http://www.codechef.com/MAY13/problems/MSTICK/