2014 June lge code jam 2nd : template