Codeforces Beta Round #87 Problem D Lawnmower