6. (4 points) With the number written on the board, one of the following operations is allowed:
1) Replace the original number with the difference between the number obtained by removing the last three digits and the number formed by the last three digits (which may be written in an improper form - with leading zeros; the difference is taken as positive - from the larger number subtract the smaller one).
2) If the original number contains a digit not equal to 9, which has two neighboring digits greater than 0, this digit can be increased by 1, and the neighboring digits can be decreased by 1. If zeros appear at the beginning of the number as a result, they are discarded.

Initially, the number consisting of 98 eights was written on the board. In the end, a two-digit number remained. What exactly is it?
# Answer: 88 or 94

## Solution:

Let the number be $1000a + b$, where $b < 1000$, and the first operation is performed on it. Then it transforms into $a - b$ or $b - a$. In the first case, we add these numbers, and in the second case, we subtract them - the result is $1001a$, which is divisible by 91. This means that if the remainder of the division of the number by 91 was $x$ before the operation, then after the operation, the remainder of the division of the new number is either $91 - x$ or still $x$.

Now consider the second operation. When this operation is performed, $10^n$ is added to the number, and then $10^{n+1}$ and $10^{n-1}$ are subtracted from it. In total, $91 \cdot 10^{n-1}$ is subtracted from the number, so the remainder of the division by 91 remains unchanged.

The initial number had a remainder of 88 when divided by 91 (since $888888 = 888 \cdot 1001$ is divisible by 91, and thus a number consisting of 96 eights and two zeros at the end is divisible by 91). Therefore, the final number can give remainders of 88 or 3 when divided by 91, and among two-digit numbers, these are only 88 and 94.

Now we will prove that both numbers can be obtained.

By applying the first operation to the number consisting of eights twice, we simply reduce the number of eights by 6. After multiple applications of this operation, we will end up with the number 88.

To get 94, we need to stop four steps earlier, i.e., at the number 88888888. From it, we get 88887978, then 88878878, then 88878787, then 88878696, then 88192, and finally 94.