http://www.hackerearth.com/may-easy-challenge-14/algorithm/abed-and-timelines/