Let $p>$ be a prime number and $S$ be a set of $p+1$ integers. Prove that there exist pairwise distinct numbers $a_1,a_2,...,a_{p-1}\in S$ that $$ a_1+2a_2+3a_3+...+(p-1)a_{p-1}$$is divisible by $p$.
Source: Poland - Second Round 2020 P5
Tags: number theory, prime numbers
Let $p>$ be a prime number and $S$ be a set of $p+1$ integers. Prove that there exist pairwise distinct numbers $a_1,a_2,...,a_{p-1}\in S$ that $$ a_1+2a_2+3a_3+...+(p-1)a_{p-1}$$is divisible by $p$.