5. The numbers 1, 2, 3, 4, 5, 6, 7, and 8 are randomly arranged in a circle. For each such arrangement, we determine all eight sums of four consecutive numbers and denote the largest of these sums by $m$. What is the smallest possible value of the number $m$? Justify your answer.
5. If eight numbers are arranged in some order in a circular sequence, eight sums of four consecutive numbers are obtained. Since each of the numbers $1,2,3,4,5,6,7$ and 8 is an addend in exactly four sums, the sum of these eight sums is

$$
4 \cdot(1+2+3+4+5+6+7+8)=4 \cdot 36=144
$$

If we assume that $m=18$, all the mentioned eight sums would have to be equal to 18 because $8 \cdot 18=144$.

However, if $a, b, c, d, e$ are some five consecutive numbers, then $a+b+c+d \neq b+c+d+e$ because $a \neq e$. This means that $m$ cannot be 18, so $m>18$.

Determine one arrangement such that the largest sum of any four consecutive numbers is 19.

Arrange the numbers so that the numbers 8 and 7 are not in the same sum, nor are the numbers 6 and 5, 4 and 3, or 2 and 1, as shown in the figure.

![](https://cdn.mathpix.com/cropped/2024_05_30_a352c90277a7a8846681g-5.jpg?height=591&width=585&top_left_y=1458&top_left_x=741)

The eight sums are:

$1+4+5+8=18$

$4+5+8+2=19$,

$5+8+2+3=18$,

$8+2+3+6=19$,

$2+3+6+7=18$,

$3+6+7+1=17$,

$6+7+1+4=18$,

$7+1+4+5=17$,

so $m=19$.