Let $ABCD$ be a quadrilateral with an inscribed circle $\omega$ and let $P$ be the intersection of its diagonals $AC$ and $BD$. Let $R_1$, $R_2$, $R_3$, $R_4$ be the circumradii of triangles $APB$, $BPC$, $CPD$, $DPA$ respectively. If $R_1=31$ and $R_2=24$ and $R_3=12$, find $R_4$.

Let's think step by step and output the final answer within \boxed{}.
user