4. Given $n(n \geqslant 3)$ lines where exactly $m(m \geqslant 2)$ lines are parallel, and no three lines intersect at the same point. The maximum number of regions these $n$ lines can divide the plane into is $\qquad$
4. $\frac{1}{2}\left(n^{2}+n-m^{2}+m\right)+1$.

Consider these $m$ parallel lines, which divide the plane into $m+1$ parts, denoted as $a_{m}=m+1$. Adding one more line, it is divided into $m+1$ segments by the $m$ lines, at this point, the number of parts the plane is divided into increases by $m+1$ parts, and the plane is now divided into $a_{m+1}=a_{m}+m+1=2 m+2$ parts. Adding another line, it is divided into $m+2$ segments by the previous $m+1$ lines, at this point, the number of parts the plane is divided into increases by $m+2$ parts, and the plane is now divided into $a_{m+2}=a_{m+1}+m+2=3 m+4 . \cdots \cdots$. Therefore, $a_{k+1}=a_{k}+k+1(k \geqslant m)$, which means $a_{k+1}-a_{k}=k+1$.
$$
\begin{array}{l} 
\text { Then } a_{n}=a_{m}+\left(a_{m+1}-a_{m}\right)+\left(a_{m+2}-a_{m+1}\right)+ \\
\cdots+\left(a_{n}-a_{n-1}\right) \\
=(m+1)+(m+1)+(m+2)+\cdots+n \\
= m+1+\frac{m+1+n}{2}(n-m) \\
= \frac{1}{2}\left(n^{2}+n-m^{2}+m\right)+1 .
\end{array}
$$