4. Write an arithmetic sequence in the following manner:

1st row: 2
2nd row: 5, 8
3rd row: $11, 14, 17$
4th row: $20, 23, 26, 29$
$\qquad$
$m$-th row: $a_{m 1}, a_{m 2}, a_{m 3}, \cdots, a_{m n}$ $a_{m i}$ represents the $i$-th number in the $m$-th row, $i=1,2,3, \cdots, m$.
Then, the sum of the $m$ numbers in the $m$-th row is $\qquad$
4. $\frac{1}{2} m\left(3 m^{2}+1\right)$.

From the induction, we know that $a_{m 1}-a_{(m-1) 1}=3 \times(m-1)$. Therefore,
$$
a_{m 1}=\sum_{i=1}^{m-1} 3 i+2=\frac{3 m(m-1)}{2}+2 \text {. }
$$

Also, $a_{m m}=a_{(m+1) 1}-3=\frac{3 m(m+1)}{2}-1$, so
$$
\sum_{i=1}^{m} a_{m i}=\frac{m}{2}\left(a_{m l}+a_{m m m}\right)=\frac{1}{2} m\left(3 m^{2}+1\right)
$$