20. Use $m(m \geqslant 2)$ colors to paint the $n$ vertices of a regular $n(n \geqslant 3)$-sided polygon, with each vertex painted a different color, and adjacent vertices having different colors. Find the number of distinct colorings of the vertices of the regular $n$-sided polygon, denoted as $g(m, n)$.
20. $g(m, n)=\frac{1}{n} \sum_{\substack{d \mid n \\ d \neq n}} \varphi(d)\left[(m-1)^{\frac{n}{d}}+(-1)^{\frac{n}{d}}(m-1)\right]$.