(height // sideLength) * (width // sideLength)
.answer = maxOnes * (height // sideLength) * (width // sideLength)
.cnt1 = min((height % sideLength) * (width % sideLength), maxOnes)
.cnt1 * ((height // sideLength) + (width // sideLength) + 1)
, and increment answer
by this value.maxOnes - cnt1
.answer
by these values.answer
.