5. On the number line, points with integer coordinates are painted red and blue according to the following rules: a) points whose coordinate difference is 7 must be painted the same color; b) points with coordinates 20 and 14 should be painted red, and points with coordinates 71 and 143 - blue. In how many ways can all points with integer coordinates be painted, while adhering to these rules?
Answer. In eight ways.

Solution. From part a), it follows that the coloring of all points with integer coordinates is uniquely determined by the coloring of the points corresponding to the numbers $0,1,2,3,4,5$, and 6. The point $0=14-2 \cdot 7$ must be colored the same as 14, i.e., red. Similarly, the point $1=71-10 \cdot 7$ must be colored blue, the point $3=143-20 \cdot 7$ - blue, and $6=20-2 \cdot 7$ - red. Therefore, it remains to count the number of different ways to color the points corresponding to the numbers 2, 4, and 5. Since each point can be colored in two ways - red or blue - the total number of ways is $2 \cdot 2 \cdot 2=8$.

Note. When counting the number of ways to color the points 2, 4, and 5, one can simply list all the ways, for example, in a table:

| 2 | 4 | 5 |
| :--- | :--- | :--- |
| $\kappa p$ | $\kappa p$ | $\kappa p$ |
| $\kappa p$ | $\kappa p$ | $c i n$ |
| $\kappa p$ | $c u n$ | $\kappa p$ |
| $\kappa p$ | $c u n$ | $c i n$ |
| $c u n$ | $\kappa p$ | $\kappa p$ |
| $c i n$ | $\kappa p$ | $c i n$ |
| $c i n$ | $c i n$ | $\kappa p$ |
| $c i n$ | $c i n$ | $c i n$ |

Grading criteria.

- Correct answer with proper justification - 7 points.
- The problem is reduced to counting the number of ways to color 3 points, but the answer is 6 or 7 - 4 points.
- The problem is reduced to counting the number of ways to color 3 points, but the calculation of the number of ways is missing or the answer is different from the ones mentioned earlier - 3 points.
- Answer (including the correct one) without justification - 0 points.