4. (7 points) Petya was adding two natural numbers and by mistake appended an extra digit to the end of one of them. As a result, instead of getting the correct answer of 12345, he got the sum of 44444. What numbers was he adding?

#
# Solution.

Let Pete need to add numbers $x$ and $y$. When he appended a digit $c$ to one of them (for definiteness, to $x$), the number became $10 x + c$. Thus, we obtain the system of equations:

$$
\left\{\begin{array}{c}
x + y = 12345 \\
(10 x + c) + y = 44444
\end{array}\right.
$$

Subtracting the first equation from the second, we get $9 x + c = 32099$, which means $9 x = 32099 - c$. Therefore, $(32099 - c)$ is divisible by 9. Considering that $c$ is a digit, we find that the only possible value for $c$ is $5$. In this case, $9 x = 32094$, and $x = 3566$. Then $y = 12345 - x = 8779$.

Thus, Pete was supposed to add the numbers 3566 and 8779, but he mistakenly appended a 5 to the end of the first number and actually added the numbers 35665 and 8779.

Answer. 3566 and 8779.