Margarite and the best present

CodeForces - 1080B