Google Code Jam 2014 Round1A
Problem B small