Problem 2. Let $a, b, c, d$ be natural numbers such that $a+b+c+d=2018$. Find the minimum value of the expression

$$
E=(a-b)^{2}+2(a-c)^{2}+3(a-d)^{2}+4(b-c)^{2}+5(b-d)^{2}+6(c-d)^{2}
$$
## Solution:

We show that the sought minimum is 14.

This value is indeed attained, for example if $a=b=505$ and $c=d=504$. . . 1p Since $2018$ is not divisible by 4, the numbers $a, b, c, d$ cannot all be equal.

If three of them are equal, then three of the squares are 0, and the other three are non-zero. Moreover, the four numbers must have the same parity, so the other squares are at least 4. Thus $E \geq 4+2 \cdot 4+3 \cdot 4>14$.

$2 p$

If two of the numbers are equal, and the other two are different (from these two and from each other), then $E \geq 1+2+3+4+5=15>14$.

$1 p$

If two of the numbers are equal, and the other two are also equal, then:

$a=b, c=d$ implies $E \geq 2+3+4+5=14, a=c, b=d$ implies $E \geq 1+3+4+6=14$, and $a=d, b=c$ implies $E \geq 1+2+5+6=14$.