4. Vanya wrote down a four-digit number, subtracted a two-digit number from it, multiplied the result by a two-digit number, divided by the sum of two single-digit numbers, added a single-digit number, and then divided the result by the sum of three single-digit numbers. To write all the numbers, he used only one digit (not 0). Vanya got an integer as the answer. What is this number, and which digit could Vanya have used?
Answer: 2017; any digit.

Solution. Let the digit be $a$. We get $\left(\frac{(\overline{a a a a}-\overline{a \bar{a}} \cdot \cdot \overline{a a}}{a+a}+a\right):(a+a+a)$. Then

$$
\overline{a a a a}-\overline{a a}=\overline{a a 00}=a \cdot 1100 \Rightarrow \frac{\bar{a}}{a a}=a \cdot 11
$$

The numerator of the fraction is equal to $a \cdot 1100 \cdot a \cdot 11=a \cdot a \cdot 12100$. The fraction $\frac{(\overline{a a a \bar{a}}-\overline{a a}) \cdot \overline{a \bar{a}}}{a+a}=a \cdot 6050$. Then the expression $\frac{(\overline{a a a \bar{a}}-\overline{a a}) \cdot \overline{a \bar{a}}}{a+a}+a=6051 a$. Dividing by $3 a$, we get 2017, and this is true for any digit $a \neq 0$.

Comment. Finding the number for one specific digit, which is indicated in the answer - 2 points. Finding the number for several (but not all) digits, which are indicated in the answer - 3-4 points. Finding the number for several (but not all) digits, and making, but not proving, the conclusion that the digit can be any - 5 points. Finding the number for any digit (in general form or by complete enumeration) - 7 points. For useful progress without a solution - 1 point.