8. In a $3 \times 3$ grid, if each of the 9 cells is colored with one of the four colors: red, yellow, blue, and purple, and any two adjacent cells (sharing a common edge) are colored differently, and exactly 2 cells in the grid are colored blue, then the total number of valid coloring methods is $\qquad$ . (Answer with a specific number)
\begin{tabular}{|c|c|c|c|c|c|}
\hline 1 & 2 & 3 & 1 & 2 & 3 \\
\hline 4 & 5 & 6 & 4 & 5 & 6 \\
\hline 7 & 8 & 9 & 7 & 8 & 9 \\
\hline
\end{tabular}
(1)
(2)
\begin{tabular}{|l|l|l|}
\hline 1 & 2 & 3 \\
\hline 4 & 5 & 6 \\
\hline 7 & 8 & 9 \\
\hline
\end{tabular}
(3)
\begin{tabular}{|l|l|l|}
\hline 1 & 2 & 3 \\
\hline 4 & 5 & 6 \\
\hline 7 & 8 & 9 \\
\hline
\end{tabular}
(4)
\begin{tabular}{|l|l|l|}
\hline 1 & 2 & 3 \\
\hline 4 & 5 & 6 \\
\hline 7 & 8 & 9 \\
\hline
\end{tabular}
(5)
\begin{tabular}{|l|l|l|}
\hline 1 & 2 & 3 \\
\hline 4 & 5 & 6 \\
\hline 7 & 8 & 9 \\
\hline
\end{tabular}
(6)

There are 18 ways to color a $2 \times 2$ grid with three colors, as shown in (2) for 5, 6, 8, 9. When 5 and 9 have the same color, the number of coloring methods is $3 \times 2 \times 1 \times 2$; when 5 and 9 have different colors, the number of coloring methods is $3 \times 2 \times 1 \times 1$. The total is $12 + 6 = 18$ ways.
(1) The blue squares correspond to $(1,5), (3,5), (5,7), (5,9)$, and the number of coloring methods is $4 \times 3 \times 2^6 = 768$.
(2) The blue squares correspond to $(1,3), (1,7), (3,9), (7,9)$, and the number of coloring methods is $4 \times 18 \times 6 = 432$.
(3) The blue squares correspond to $(2,8), (4,6)$, and the number of coloring methods is $2 \times 3 \times 2^6 = 384$.
(4) The blue squares correspond to $(1,8), (3,8), (1,6), (7,6), (2,7), (2,9), (4,3), (4,9)$, and the number of coloring methods is $8 \times 18 \times 2^3 = 1152$.
(5) The blue squares correspond to $(2,4), (2,6), (4,8), (6,8)$, and the number of coloring methods is $4 \times 18 \times 12 = 864$.
(6) The blue squares correspond to $(1,9), (3,7)$, and the number of coloring methods is $2 \times 18 \times 6 = 216$.

In summary, the total number of valid coloring methods is $768 + 432 + 384 + 1152 + 864 + 216 = 3816$.