8. $\frac{1}{24}\left(m^{8}+17 m^{4}+6 m^{2}\right)$.
8. Use $m$ colors to paint the 8 faces of a regular octahedron, with each face painted one color. Find the number of distinct edge-colored regular octahedra that can be formed.

Using $m$ colors to paint the 8 faces of a regular octahedron, with each face painted one color, find the number of distinct edge-colored regular octahedra that can be formed.