http://www.codechef.com/JULY14/problems/FROGV