A magician asks a person in the audience to think of a number $\overline {abc}$. He then asks them to sum up $\overline{acb}, \overline{bac}, \overline{bca}, \overline{cab}, \overline{cba}$ and reveal the result. Suppose it is $3194$. What was the original number?
The obvious approach was modular arithmetic.
$(100a + 10c + b) + (100b + 10a + c) + (100b + 10c + a) + (100c + 10a + b) + (100c + 10b + a) = 3194$
$122a + 212b + 221c = 3194$
Since $122, 212, 221 \equiv 5 (mod\space9)$ and $3194 \equiv 8 (mod\space9)$
$5(a + b + c) \equiv 8 (mod\space9)$
So, $a + b + c = 7$ or $16$ or $26$
Hit and trial produces the result $358$. Any other, more elegant method?