if n and m are odd, the answer is 1.

if n is odd and m is even, then answer is (m/2 + 1)^(n/2) (and the case for if n is even and m is odd is similar)

if n and m are even, we can do a bit mask dp.

For every 0 <= i < n/2 and 0 <= j < m/2, there exists exactly obstacle in one of the squares x_{2i,2j}, x_{2i+1,2j}, x_{2i,2j+1}, x_{2i+1,2j+1}. Call these the "aligned" 2x2 subgrids. We can't do any less, since otherwise, Alice would be able to place her 2x2 block in this space, so this minimizes the number of blocks needed. We can use this fact to do a bitmask dp.

Imagine we place a block in the upper left corner of each aligned subgrid. We can optionally push the blocks in some prefix of each row right. Similarly, we can optionally push the blocks in some prefix of each column down. This will ensure that it's impossible for Alice to place her 2x2 block when one of the coordinates of the top left square is even. The only tricky case is to make sure we also exclude cases where both coordinates of the top left square are odd.

We can see in this example we can run into a bad case (here, the first row has been pushed right, and the second column has been pushed down).

.X|..
..|.X
-----
X.|..
..|X.

Fortunately, this is a local condition that we can make sure to exclude, so we can do a bitmask dp to solve this. (here, the state is length of prefix of row that's pushed right, and set of columns which we can still push down). This is still slightly too slow, so to speed it up, we can use fast walsh hadamard transform. The overall runtime is O(2^(n/2) * n^2 * m).