5. (10 points) There are some natural numbers written on the blackboard, with an average of 30; after writing down 100, the average becomes 40; if another number is written last, the average becomes 50, then what is the last number written?



Translate the above text into English, please keep the original text's line breaks and format, and output the translation result directly.
120
【Solution】Solution: $(100-40) \div(40-30)$
$$
\begin{array}{l}
=60 \div 10 \\
=6 \text { (units) } \\
6+1=7 \text { (units) } \\
7+1=8 \text { (units) } \\
50 \times 8-40 \times 7 \\
=400-280 \\
=120
\end{array}
$$

Answer: The last number written is 120. Therefore, the answer is: 120.