In isosceles triangle ABC with base BC, let M be the midpoint of BC. Let P be the intersection of the circumcircle of \triangle ACM with the circle with center B passing through M, such that P \neq M. If \angle BPC = 135^{\circ}, then \frac{CP}{AP} can be written as a + \sqrt{b} for positive integers a and b, where b is not divisible by the square of any prime. Find a + b.