MMO 2015 Problem 6

MMO 2015 PROBLEM 6

Solution