Fox and Box Accumulation

CodeForces - 389C