Let mm and nn be positive integers. Some squares of an m×nm \times n board are coloured red. A sequence a1,a2,,a2ra_1, a_2, \ldots, a_{2r} of 2r42r \geqslant 4 pairwise distinct red squares is called a bishop circuit if for every k{1,,2r}k \in \{1, \ldots, 2r\}, the squares aka_k and ak+1a_{k+1} lie on a diagonal, but the squares aka_k and ak+2a_{k+2} do not lie on a diagonal (here a2r+1=a1a_{2r+1} = a_1 and a2r+2=a2a_{2r+2} = a_2).

In terms of mm and nn, determine the maximum possible number of red squares on an m×nm \times n board without a bishop circuit.

(Remark. Two squares lie on a diagonal if the line passing through their centres intersects the sides of the board at an angle of 45°45°.)