The number on the board

CodeForces - 835B