4. Let $m, n$ be positive integers, then $\sum_{k=0}^{m-1} \cos \frac{2 k \pi}{m}+\sum_{k=0}^{n-1} \sin \frac{2 k \pi}{n}=$
When $m \geqslant 2$, since $x=\cos \frac{2 k \pi}{m}+\mathrm{i} \sin \frac{2 k \pi}{m}$ are the $m$ complex roots of the equation $x^{m}-1=0$, by Vieta's formulas, we know $\sum_{k=0}^{m-1} \cos \frac{2 k \pi}{m}=0$; when $m=1$, $\sum_{k=0}^{m-1} \cos \frac{2 k \pi}{m}=1$;
Similarly, $\sum_{k=0}^{n-1} \sin \frac{2 k \pi}{n}=0$, so the original expression $=0$ or 1.