solution: Let $\theta = \angle BAM.$  Then $\angle BDM = 3 \theta.$  Since $\angle BDM$ is external to triangle $ABD,$ $\angle BDM = \angle BAD + \angle ABD.$  Hence, $\angle ABD = \angle BDM - \angle BAD = 2 \theta.$
  
  By the Law of Sines on triangle $ABD,$
  \[\frac{BD}{\sin \theta} = \frac{AD}{\sin 2 \theta}.\]Then
  \[\frac{BD}{\sin \theta} = \frac{10}{2 \sin \theta \cos \theta} = \frac{5}{\sin \theta \cos \theta},\]so $\cos \theta = \frac{5}{BD}.$
  
  Then
  \[AB = \frac{AM}{\cos \theta} = \frac{11}{5/BD} = \frac{11}{5} BD.\]By the Pythagorean Theorem on right triangles $AMB$ and $DMB,$
  \begin{align*}
  BM^2 + 11^2 &= AB^2, \\
  BM^2 + 1^2 &= BD^2.
  \end{align*}Subtracting these equations, we get
  \[AB^2 - BD^2 = 120.\]Then
  \[\frac{121}{25} BD^2 - BD^2 = 120,\]so $BD = \frac{5 \sqrt{5}}{2}.$  Then $AB = \frac{11 \sqrt{5}}{2},$ and $BM = \frac{11}{2}.$  Therefore, the perimeter of triangle $ABC$ is
  \[AB + AC + BC = \frac{11}{2} \sqrt{5} + \frac{11}{2} \sqrt{5} + 11 = \boxed{11 \sqrt{5} + 11}.\]
prompt.content: <|im_start|>system
  You are a helpful assistant.<|im_end|>
  <|im_start|>user
  Triangle $ABC$ is isosceles, with $AB=AC$ and altitude $AM=11.$ Suppose that there is a point $D$ on $\overline{AM}$ with $AD=10$ and $\angle BDC=3\angle BAC.$  Find the perimeter of triangle $ABC.$
  
  [asy]
  unitsize(0.4 cm);
  
  pair A, B, C, D, M;
  
  A = (0,11);
  D = (0,1);
  B = (-11/2,0);
  C = (11/2,0);
  M = (B + C)/2;
  
  draw(A--B--C--cycle);
  draw(A--M);
  draw(B--D--C);
  
  label("$A$", A, N);
  label("$B$", B, SW);
  label("$C$", C, SE);
  label("$D$", D, NW);
  label("$M$", M, S);
  [/asy]
  Please reason step by step, and put your final answer within \boxed{{}}.<|im_end|>
  <|im_start|>assistant
  
prompt.role: user
extra_info.answer: 11 \sqrt{5} + 11
extra_info.question: Triangle $ABC$ is isosceles, with $AB=AC$ and altitude $AM=11.$ Suppose that there is a point $D$ on $\overline{AM}$ with $AD=10$ and $\angle BDC=3\angle BAC.$  Find the perimeter of triangle $ABC.$
  
  [asy]
  unitsize(0.4 cm);
  
  pair A, B, C, D, M;
  
  A = (0,11);
  D = (0,1);
  B = (-11/2,0);
  C = (11/2,0);
  M = (B + C)/2;
  
  draw(A--B--C--cycle);
  draw(A--M);
  draw(B--D--C);
  
  label("$A$", A, N);
  label("$B$", B, SW);
  label("$C$", C, SE);
  label("$D$", D, NW);
  label("$M$", M, S);
  [/asy]
extra_info.split: test