5. If the arithmetic sequence $\left\{a_{n}\right\}$ and the positive integer $m(m \geqslant 3)$ satisfy: $a_{1}=1, a_{m}=2$, and $\frac{1}{a_{1} a_{2}}+\frac{1}{a_{2} a_{3}}+\cdots+\frac{1}{a_{m-1} a_{m}}=3$, then $a_{1}+a_{2}+\cdots+a_{m}=$ $\qquad$ .
Let $\left\{a_{n}\right\}$ be an arithmetic sequence with common difference $d$, then $\frac{1}{a_{1} a_{2}}+\frac{1}{a_{2} a_{3}}+\cdots+\frac{1}{a_{m-1} a_{m}}=\frac{1}{d} \sum_{i=1}^{m-1}\left(\frac{1}{a_{i}}-\frac{1}{a_{i+1}}\right)$ $=\frac{1}{d}\left(\frac{1}{a_{1}}-\frac{1}{a_{m}}\right)=\frac{m-1}{a_{1} a_{m}}=\frac{m-1}{2}=3 \Rightarrow m=7$.
Therefore, $a_{1}+a_{2}+\cdots+a_{m}=\frac{7\left(a_{1}+a_{m}\right)}{2}=\frac{21}{2}$.