5. $m \times n$ dots are arranged in a square grid to form a rectangle. How many possibilities are there to color these points red or white so that there are exactly two white and two red points among every four points that form the corners of a unit square?

## Solution:
We look at the grid so that it has $m$ rows and $n$ columns. We color the points row by row and start with the first row. Assume that we have already colored the $k$th row.

We call a coloring of the $k+1$-th line permissible if the condition of the task is fulfilled for the $k$-th and $k+1$-th lines. Each permissible coloring of the $k+1$-th line is obviously already completely determined by the color of any point. This is because each point in the $k+1$th row determines the color of the points immediately adjacent to it. Therefore, there are at most two permissible colorings of the $k+1$-th line. There is always one: the inverse coloring, where no point has the same color as the point directly above it. If two adjacent points of the $k$th line have the same color, then the color of the two points below is uniquely determined, so there is only one permissible coloring of the $k+1$th line, the inverse coloring. However, if the points in the $k$th line are alternately colored red and white, then the $k+1$th line can be colored in two ways, namely the same as the $k$th or inverse to it.

There are exactly 2 ways to color the first line alternately white and red. After that, each additional line can also be colored in exactly two ways, as we explained above. There are therefore a total of $2^{m}$ such colorings.

For the remaining $2^{n}-2$ possible colorings of the first line, there are always two adjacent points with the same color. Consequently, each additional line can be colored in exactly one way. There are $2^{n}-2$ such colorings.

All in all, this results in the solution

$$
2^{m}+2^{n}-2
$$