## Task B-3.3.

To access a certain webpage, Matko has to choose a 4-digit PIN. Leading zeros are allowed, but there are some requirements (restrictions) on the PIN. No digit can be repeated three or more times in a row. For example, 0006 or 6666 are not allowed PINs, but 0030 is an allowed PIN. Additionally, no pair of digits can be repeated. For example, 1616 is not an allowed PIN, but 1661 or 6611 are allowed PINs. In how many different ways can Matko choose the PIN?
## Solution.

We can choose a combination of 4 digits in $10 \cdot 10 \cdot 10 \cdot 10=10000$ ways.

From this, we will subtract all the prohibited combinations.

PINs in which exactly three digits are the same in a row are of the form aaab or baaa (with $a \neq b$), and there are $2 \cdot 10 \cdot 9=180$ of them.

PINs of the form aaaa are 10,

and PINs of the form abab are $10 \cdot 9=90$.

The total number of allowed combinations for PINs is

$$
10000-(180+10+90)=10000-280=9720
$$