The diagram below shows twelve $30-60-90$ triangles placed in a circle so that the hypotenuse of each triangle coincides with the longer leg of the next triangle. The fourth and last triangle in this diagram are shaded. The ratio of the perimeters of these two triangles can be written as $\tfrac{m}{n}$ where $m$ and $n$ are relatively prime positive integers. Find $m + n$.

[asy]
size(200);
defaultpen(linewidth(0.8));
pair point=(-sqrt(3),0);
pair past,unit;
path line;
for(int i=0;i<=12;++i) {
past = point;
line=past--origin;
unit=waypoint(line,1/200);
point=extension(past,rotate(90,past)*unit,origin,dir(180-30*i));
if (i == 4) {
filldraw(origin--past--point--cycle,gray(0.7));
} else if (i==12) {
filldraw(origin--past--point--cycle,gray(0.7));
} else {
draw(origin--past--point);
}
}
draw(origin--point);
[/asy]
1. **Understanding the problem**: We have twelve $30^\circ-60^\circ-90^\circ$ triangles arranged in a circle. The hypotenuse of each triangle coincides with the longer leg of the next triangle. We need to find the ratio of the perimeters of the fourth and the last (twelfth) triangle.

2. **Properties of $30^\circ-60^\circ-90^\circ$ triangles**: In a $30^\circ-60^\circ-90^\circ$ triangle, the sides are in the ratio $1 : \sqrt{3} : 2$. Let the shorter leg be $x$, then the longer leg is $x\sqrt{3}$ and the hypotenuse is $2x$.

3. **Transformation of triangles**: Each triangle's hypotenuse becomes the longer leg of the next triangle. Therefore, if the shorter leg of the first triangle is $x$, the longer leg is $x\sqrt{3}$, and the hypotenuse is $2x$.

4. **Recursive relationship**: The hypotenuse of the $n$-th triangle becomes the longer leg of the $(n+1)$-th triangle. Thus, if the shorter leg of the $n$-th triangle is $x_n$, then:
   \[
   x_{n+1} = 2x_n
   \]
   The longer leg of the $(n+1)$-th triangle is:
   \[
   x_{n+1}\sqrt{3} = 2x_n\sqrt{3}
   \]
   The hypotenuse of the $(n+1)$-th triangle is:
   \[
   2x_{n+1} = 4x_n
   \]

5. **Finding the perimeters**: The perimeter of a $30^\circ-60^\circ-90^\circ$ triangle is the sum of its sides. For the $n$-th triangle, the perimeter $P_n$ is:
   \[
   P_n = x_n + x_n\sqrt{3} + 2x_n = x_n(3 + \sqrt{3})
   \]

6. **Perimeter ratio**: We need the ratio of the perimeters of the fourth and the twelfth triangles. Let the shorter leg of the first triangle be $x_1 = x$. Then:
   \[
   x_4 = 2^3 x = 8x
   \]
   \[
   x_{12} = 2^{11} x = 2048x
   \]
   The perimeters are:
   \[
   P_4 = 8x(3 + \sqrt{3})
   \]
   \[
   P_{12} = 2048x(3 + \sqrt{3})
   \]
   The ratio of the perimeters is:
   \[
   \frac{P_4}{P_{12}} = \frac{8x(3 + \sqrt{3})}{2048x(3 + \sqrt{3})} = \frac{8}{2048} = \frac{1}{256}
   \]

7. **Simplifying the ratio**: The ratio $\frac{1}{256}$ can be written as $\frac{m}{n}$ where $m = 1$ and $n = 256$. Since $m$ and $n$ are relatively prime, we have:
   \[
   m + n = 1 + 256 = 257
   \]

The final answer is $\boxed{257}$.