You are given a board of m*n, so there are m*n unit squares(1*1) in the board. Suppose all unit squares are colored red or blue, and no adjacent(have common edge) unit squares share the same color. Consider the diagonal D of the board from left bottom to right top, D is a segment with color too, a point in D is red(or blue) if it falls in a red(or blue) unit square. Assume the left bottom square's color is red, then what is the total length of red part of the diagonal D?

the sample of 2 * 4 board

the total length of red part of the diagonal is 2.236068