https://www.hackerrank.com/contests/overnite2014/challenges/3x2y