8. (4 points) For Valentine's Day, the boy Zhenya was given a chocolate bar of size $2 \times 4$, on each piece of which a unique picture is drawn. In each move, Zhenya can bite off one piece that has no more than two common sides with other pieces that have not yet been eaten. In how many ways can Zhenya eat his chocolate bar?
Answer: 6720.

## Solution:

The first cell to be eaten is necessarily a corner cell (4 ways). After this, there are 4 options:

1) The second cell to be eaten is the adjacent corner cell (1 way). A $2 \times 3$ rectangle remains. From this, the first cell to be eaten is again a corner cell (4 ways). After this, one cell remains inaccessible.

1.1) The fourth cell to be eaten is the only cell not adjacent to the inaccessible cell (1 way). Then, the cell adjacent to the inaccessible cell is eaten (3 ways). The remaining 3 cells can be eaten in any order (3! ways). In total, $4 \cdot 1 \cdot 4 \cdot 1 \cdot 3 \cdot 3! = 288$ ways.

1.2) The fourth cell to be eaten is adjacent to the inaccessible cell (3 ways). The remaining 4 cells can be eaten in any order (4! ways). In total, $4 \cdot 1 \cdot 4 \cdot 3 \cdot 4! = 1152$ ways.

In total, 1440 ways for case 1).

2) The second cell to be eaten is an adjacent non-corner cell (1 way). After this, one cell remains inaccessible, with three adjacent cells.

2.1) The third cell to be eaten is one of the three cells adjacent to the inaccessible cell (3 ways). Then, all cells can be eaten in $5!$ ways. In total, $4 \cdot 1 \cdot 3 \cdot 5! = 1440$ ways.

2.2) The third cell to be eaten is not adjacent to the inaccessible cell (2 ways).

2.2.1) The fourth cell to be eaten is one of the three cells adjacent to the inaccessible cell (3 ways). Then, all cells can be eaten in 4! ways. In total, $4 \cdot 1 \cdot 2 \cdot 3 \cdot 4! = 576$ ways.

2.2.2) The fourth cell to be eaten is not adjacent to the inaccessible cell (1 way). Then, one of the cells adjacent to the inaccessible cell is eaten (3 ways). Then, all cells can be eaten in $3!$ ways. In total, $4 \cdot 1 \cdot 2 \cdot 1 \cdot 3 \cdot 3! = 144$ ways.

In total, 2160 ways for case 2).

3) The second cell to be eaten is a corner cell on the same long side as the already eaten one. After this, two cells remain inaccessible, each with three adjacent cells. Further reasoning is similar to case 1). In the end, the same 1440 ways.
4) The second cell to be eaten is the cell opposite the eaten one (1 way).

4.1) If after this we eat a corner cell, we are left with a figure identical to case 1), which can be eaten in $3 \cdot 4! + 3 \cdot 3!$ ways. This number must be multiplied by 8, resulting in 720 ways.

4.2) If a non-corner cell is eaten, all cells become accessible and can be eaten in 5! ways. In total, $4 \cdot 1 \cdot 2 \cdot 5! = 960$ ways.

In total, 1680 ways for case 4).

In total, 6720 ways.

![](https://cdn.mathpix.com/cropped/2024_05_06_4341ef452ac0222db066g-10.jpg?height=903&width=1668&top_left_y=154&top_left_x=274)