6. Let's call the distance between numbers the absolute value of their difference. It is known that the sum of the distances from eight consecutive natural numbers to some number $a$ is 612, and the sum of the distances from these same eight numbers to some number $b$ is 240. Find all possible values of $a$, given that $a+b=100.5$.
Answer: $a=27, a=-3$.

Solution. Let the given consecutive natural numbers be denoted as $k, k+1, \ldots, k+7$. Notice that if some number lies in the interval $[k ; k+8]$, then the sum of the distances from it to the given eight numbers does not exceed $4 \cdot 7=28$ (the sum of the distances to the two extreme numbers is exactly 7, the sum of the distances to $k+1$ and $k+6$ does not exceed 7, the sum of the distances to $k+2$ and $k+5$ also does not exceed 7, and so on). Therefore, the numbers $a$ and $b$ lie outside the interval $[k ; k+7]$. Then the sum of the distances from the number $a$ to each of the given consecutive numbers is expressed by the formula $|8 a-k-(k+1)-\ldots-(k+7)|=8|a-k-3.5|$. Similarly, the sum of the distances from the number $b$ to each of the given numbers is $8|b-k-3.5|$. We obtain the system of equations

$$
\left\{\begin{array} { l } 
{ 8 | a - k - 3 , 5 | = 6 1 2 , } \\
{ 8 | b - k - 3 , 5 | = 2 4 0 , } \\
{ a + b = 1 0 0 , 5 }
\end{array} \Leftrightarrow \left\{\begin{array}{l}
|a-k-3.5|=76.5 \\
|b-k-3.5|=30 \\
a+b=100.5
\end{array}\right.\right.
$$

Consider four cases for the removal of the modulus.

1) Both numbers $a$ and $b$ lie to the right of the interval $[k ; k+7]$. Then

$$
\left\{\begin{array} { l } 
{ a - k - 3 , 5 = 7 6 , 5 , } \\
{ b - k - 3 , 5 = 3 0 , } \\
{ a + b = 1 0 0 , 5 }
\end{array} \Leftrightarrow \left\{\begin{array}{l}
a=73.5 \\
b=27 \\
k=-6.5
\end{array}\right.\right.
$$

Since $k$ must be a natural number, this case does not fit.

2) Both numbers $a$ and $b$ lie to the left of the interval $[k ; k+7]$. Then

$$
\left\{\begin{array} { l } 
{ - a + k + 3 , 5 = 7 6 , 5 , } \\
{ - b + k + 3 , 5 = 3 0 , } \\
{ a + b = 1 0 0 , 5 }
\end{array} \Leftrightarrow \left\{\begin{array}{l}
a=27 \\
b=73.5 \\
k=100
\end{array}\right.\right.
$$

3) The number $a$ lies to the right, and $b$ lies to the left of the interval $[k ; k+7]$. Then

$$
\left\{\begin{array} { l } 
{ a - k - 3 , 5 = 7 6 , 5 , } \\
{ - b + k + 3 , 5 = 3 0 , } \\
{ a + b = 1 0 0 , 5 }
\end{array} \Leftrightarrow \left\{\begin{array}{l}
a=103.5 \\
b=-3 \\
k=23.5
\end{array}\right.\right.
$$

This case also does not fit.

4) The number $b$ lies to the right, and $a$ lies to the left of the interval $[k ; k+7]$. Then

$$
\left\{\begin{array} { l } 
{ - a + k + 3 , 5 = 7 6 , 5 , } \\
{ b - k - 3 , 5 = 3 0 , } \\
{ a + b = 1 0 0 , 5 }
\end{array} \Leftrightarrow \left\{\begin{array}{l}
a=-3 \\
b=103.5 \\
k=70
\end{array}\right.\right.
$$

Thus, there are two possible cases: $a=-3, a=27$.