49. At the base of the pyramid $A B C D M$ lies a square $A B C D$ with side $a$, the lateral edges $A M$ and $B M$ are also equal to $a$, the lateral edges $C M$ and $D M$ have length $b$. On the face $C D M$, as the base, a triangular pyramid $C D M N$ is constructed outward, with lateral edges of length $a$. Find the distance between the lines $A D$ and $M N$.
49. The polyhedron $A B M D C N$ is a triangular prism with base $A B M$, lateral edges $A D, B C', M N$,

$$
\text { Answer: } \frac{b}{2 a} \sqrt{4 a^{2}-b^{2}}
$$