Equilateral triangle $\triangle ABC$ is inscribed in circle $\omega$ with radius $18.$ Circle $\omega_A$ is tangent to sides $\overline{AB}$ and $\overline{AC}$ and is internally tangent to $\omega.$ Circles $\omega_B$ and $\omega_C$ are defined analogously. Circles $\omega_A,$ $\omega_B,$ and $\omega_C$ meet in six points---two points for each pair of circles. The three intersection points closest to the vertices of $\triangle ABC$ are the vertices of a large equilateral triangle in the interior of $\triangle ABC,$ and the other three intersection points are the vertices of a smaller equilateral triangle in the interior of $\triangle ABC.$ The side length of the smaller equilateral triangle can be written as $\sqrt{a} - \sqrt{b},$ where $a$ and $b$ are positive integers. Find $a+b.$
We can extend $AB$ and $AC$ to $B'$ and $C'$ respectively such that circle $\omega_A$ is the incircle of $\triangle AB'C'$.
[asy] /* Made by MRENTHUSIASM */ size(300); pair A, B, C, B1, C1, W, WA, WB, WC, X, Y, Z; A = 18*dir(90); B = 18*dir(210); C = 18*dir(330); B1 = A+24*sqrt(3)*dir(B-A); C1 = A+24*sqrt(3)*dir(C-A); W = (0,0); WA = 6*dir(270); WB = 6*dir(30); WC = 6*dir(150); X = (sqrt(117)-3)*dir(270); Y = (sqrt(117)-3)*dir(30); Z = (sqrt(117)-3)*dir(150);  filldraw(X--Y--Z--cycle,green,dashed); draw(Circle(WA,12)^^Circle(WB,12)^^Circle(WC,12),blue); draw(Circle(W,18)^^A--B--C--cycle); draw(B--B1--C1--C,dashed); dot("$A$",A,1.5*dir(A),linewidth(4)); dot("$B$",B,1.5*(-1,0),linewidth(4)); dot("$C$",C,1.5*(1,0),linewidth(4)); dot("$B'$",B1,1.5*dir(B1),linewidth(4)); dot("$C'$",C1,1.5*dir(C1),linewidth(4)); dot("$O$",W,1.5*dir(90),linewidth(4)); dot("$X$",X,1.5*dir(X),linewidth(4)); dot("$Y$",Y,1.5*dir(Y),linewidth(4)); dot("$Z$",Z,1.5*dir(Z),linewidth(4)); [/asy]
Since the diameter of the circle is the height of this triangle, the height of this triangle is $36$. We can use inradius or equilateral triangle properties to get the inradius of this triangle is $12$ (The incenter is also a centroid in an equilateral triangle, and the distance from a side to the centroid is a third of the height). Therefore, the radius of each of the smaller circles is $12$.
Let $O=\omega$ be the center of the largest circle. We will set up a coordinate system with $O$ as the origin. The center of $\omega_A$ will be at $(0,-6)$ because it is directly beneath $O$ and is the length of the larger radius minus the smaller radius, or $18-12 = 6$. By rotating this point $120^{\circ}$ around $O$, we get the center of $\omega_B$. This means that the magnitude of vector $\overrightarrow{O\omega_B}$ is $6$ and is at a $30$ degree angle from the horizontal. Therefore, the coordinates of this point are $(3\sqrt{3},3)$ and by symmetry the coordinates of the center of $\omega_C$ is $(-3\sqrt{3},3)$.
The upper left and right circles intersect at two points, the lower of which is $X$. The equations of these two circles are:
\begin{align*} (x+3\sqrt3)^2 + (y-3)^2 &= 12^2, \\ (x-3\sqrt3)^2 + (y-3)^2 &= 12^2. \end{align*}
We solve this system by subtracting to get $x = 0$. Plugging back in to the first equation, we have $(3\sqrt{3})^2 + (y-3)^2 = 144 \implies (y-3)^2 = 117 \implies y-3 = \pm \sqrt{117} \implies y = 3 \pm \sqrt{117}$. Since we know $X$ is the lower solution, we take the negative value to get $X = (0,3-\sqrt{117})$.
We can solve the problem two ways from here. We can find $Y$ by rotation and use the distance formula to find the length, or we can be somewhat more clever. We notice that it is easier to find $OX$ as they lie on the same vertical, $\angle XOY$ is $120$ degrees so we can make use of $30-60-90$ triangles, and $OX = OY$ because $O$ is the center of triangle $XYZ$. We can draw the diagram as such:
[asy] /* Made by MRENTHUSIASM */ size(300); pair A, B, C, B1, C1, W, WA, WB, WC, X, Y, Z; A = 18*dir(90); B = 18*dir(210); C = 18*dir(330); B1 = A+24*sqrt(3)*dir(B-A); C1 = A+24*sqrt(3)*dir(C-A); W = (0,0); WA = 6*dir(270); WB = 6*dir(30); WC = 6*dir(150); X = (sqrt(117)-3)*dir(270); Y = (sqrt(117)-3)*dir(30); Z = (sqrt(117)-3)*dir(150);  filldraw(X--Y--Z--cycle,green,dashed); draw(Circle(WA,12)^^Circle(WB,12)^^Circle(WC,12),blue); draw(Circle(W,18)^^A--B--C--cycle); draw(B--B1--C1--C^^W--X^^W--Y^^W--midpoint(X--Y),dashed); dot("$A$",A,1.5*dir(A),linewidth(4)); dot("$B$",B,1.5*(-1,0),linewidth(4)); dot("$C$",C,1.5*(1,0),linewidth(4)); dot("$B'$",B1,1.5*dir(B1),linewidth(4)); dot("$C'$",C1,1.5*dir(C1),linewidth(4)); dot("$O$",W,1.5*dir(90),linewidth(4)); dot("$X$",X,1.5*dir(X),linewidth(4)); dot("$Y$",Y,1.5*dir(Y),linewidth(4)); dot("$Z$",Z,1.5*dir(Z),linewidth(4)); [/asy]
Note that $OX = OY = \sqrt{117} - 3$. It follows that
\begin{align*} XY &= 2 \cdot \frac{OX\cdot\sqrt{3}}{2} \\ &= OX \cdot \sqrt{3} \\ &= (\sqrt{117}-3) \cdot \sqrt{3} \\ &= \sqrt{351}-\sqrt{27}. \end{align*}
Finally, the answer is $351+27 = \boxed{378}$.
~KingRavi