2. As shown in Figure 1, the graph of the even function $f(x)$ is shaped like the letter $\mathrm{M}$, and the graph of the odd function $g(x)$ is shaped like the letter N. If the number of real roots of the equations
$$
\begin{array}{l}
f(f(x))=0, f(g(x))=0, \\
g(g(x))=0, g(f(x))=0
\end{array}
$$

are $a$, $b$, $c$, and $d$ respectively, then $a+b+c+d=(\quad)$.
(A) 27
(B) 30
(C) 33
(D) 36
2. B.

Obviously, $f(x)=0$ has 3 roots $0, \pm p(1<p<2)$, $g(x)=0$ has 3 roots $0, \pm q(0<q<1)$.

The roots of the equation $f(f(x))=0$ are the roots of the equations $f(x)=0, \pm p$, among which, $f(x)=0$ has 3 roots, and $f(x)=\pm p(1<p<2)$ has no real roots, so $a=3$;

The roots of the equation $f(g(x))=0$ are the roots of the equations $g(x)=0, \pm p$, and each of these equations has 3 roots, so $b=9$;

The roots of the equation $g(g(x))=0$ are the roots of the equations $g(x)=0, \pm q$, and each of these equations has 3 roots, so $c=9$.

The roots of the equation $g(f(x))=0$ are the roots of the equations $f(x)=0, \pm q$, among which, $f(x)=0$ has 3 roots, $f(x)=q(0<q<1)$ has 4 roots, and $f(x)=-q(0<q<1)$ has 2 roots, so $d=9$.
Therefore, $a+b+c+d=3+9+9+9=30$.