The inscribed circle of triangle $ABC$ is tangent to $\overline{AB}$ at $P,$ and its radius is $21$. Given that $AP=23$ and $PB=27,$ find the perimeter of the triangle.

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