5. Given the number $500 \ldots 005$ (80 zeros). It is required to replace some two zeros with non-zero digits so that after the replacement, the resulting number is divisible by 165. In how many ways can this be done?
Answer: 17280.

Solution. $165=3 \cdot 5 \cdot 11$. Divisibility by 5 is always satisfied since the number ends in a five. For divisibility by 11, it is significant on which positions the replaceable digits stand.

First case. We replace two zeros in positions of the same parity (both even or both odd). For divisibility by 11, the sum of the two new digits must be divisible by 11, and since each digit is within [1;9], the sum must be 11. Note that divisibility by 3 is automatically satisfied (the sum of the digits of the number is $10+11=21$). The following pairs of digits fit: $2--9,3--8,4--7$, 5 - -6. Let's count the number of ways to perform the replacement. First, we choose one of these four pairs of digits (4 ways), then place the smaller digit in the place of any zero (80 ways); finally, place the larger digit in the same parity position (39 ways) - in total, we get $4 \cdot 80 \cdot 39=12480$ ways.

Second case. We replace two zeros in positions of different parity. Then, for divisibility by 11, these digits must be the same (denote each by $k$), and for divisibility by 3, $10+2 k \vdots 3$ must hold. This condition is satisfied by $k=1, k=4$, and $k=7$. Such a replacement can be made in $3 \cdot 40 \cdot 40=4800$ ways (choose one of the three digits, and then one of fifty even positions and one of fifty odd positions).

In total, we get $12480+4800=17280$ ways.