40. Pentagon $A B C D E$ is inscribed in a circle. Points $M, Q, N$ and $P$ are the feet of the perpendiculars dropped from vertex $E$ to sides $A B, B C, C D$ (or their extensions) and diagonal $A D$, respectively. It is known that $|E P|=d$, and the ratio of the area of triangle $M Q E$ to the area of triangle $P N E$ is $k$. Find $|E M|$.
40. Points $E, M, B$ and $Q$ (Fig. 7) lie on the same circle

![](https://cdn.mathpix.com/cropped/2024_05_21_6282cf4a54d2a9633c48g-073.jpg?height=388&width=409&top_left_y=376&top_left_x=163)

Fig. 7. with diameter $B E$, and points $E, P$, $D$ and $N$ lie on the circle with diameter $E D$.

Thus, $\widehat{E M Q}=\widehat{E B Q}=$ $=180^{\circ}-\widehat{E D C}=\widehat{E D N}=\widehat{E P N}$; similarly, $\widehat{E Q N}=\widehat{E N P}$, i.e., $\triangle E M Q$ is similar to $\triangle E P N$ with a similarity coefficient of $\sqrt{k}$. (For completeness, other cases of point placement must also be considered.)

Answer: $d V \bar{k}$.