Let $x=\angle CAM$, so $3x=\angle CDM$. Then, $\frac{\tan 3x}{\tan x}=\frac{CM/1}{CM/11}=11$. Expanding $\tan 3x$ using the angle sum identity gives \[\tan 3x=\tan(2x+x)=\frac{3\tan x-\tan^3x}{1-3\tan^2x}.\] 
Thus, $\frac{3-\tan^2x}{1-3\tan^2x}=11$. Solving, we get $\tan x= \frac 12$. Hence, $CM=\frac{11}2$ and $AC= \frac{11\sqrt{5}}2$ by the [Pythagorean Theorem](https://artofproblemsolving.com/wiki/index.php/Pythagorean_Theorem). The total perimeter is $2(AC + CM) = \sqrt{605}+11$. The answer is thus $a+b=\boxed{616}$.
Triangle $ABC$ is [isosceles](https://artofproblemsolving.com/wiki/index.php/Isosceles_triangle), with $AB=AC$ and [altitude](https://artofproblemsolving.com/wiki/index.php/Altitude) $AM=11.$  Suppose that there is a point $D$ on $\overline{AM}$ with $AD=10$ and $\angle BDC=3\angle BAC.$  Then the perimeter of $\triangle ABC$ may be written in the form $a+\sqrt{b},$ where $a$ and $b$ are integers.  Find $a+b.$