Question 27
Let $m, n \gt 2$ be positive integers. In each cell of an $m \times n$ grid there is a lamp, which can either be turned on or off. In one switch, we can change the state of five lamps, which are placed in cells forming a cross (see the diagram). Initially all the lamps are turned off. How many possible arrangements of lamps can be formed with these switches? Arrangements obtained from each other by rotations and reflections are considered different.

