4. In triangle $A B C$, the sides $C B=a, C A=b$. The bisector of angle $A C B$ intersects side $A B$ at point $K$, and the circumcircle of the triangle - at point $M$. The circumcircle of triangle $A M K$ intersects line $A C$ again at point $P$. Find the length of segment $A P$.
Solution. Triangle $C P K$ is equal to triangle $C B K$, since $C K$ is a common side, $\angle P C K=$ $\angle B C K, \angle K P C=\angle K M A=\angle C B K$. The last two equalities follow from the fact that inscribed angles subtending the same arc are equal. Therefore, $A P=|C P-C A|=|a-b|$.