First case 1/p + 1/20 = P

Second case 1/(p + 10) + 1/10 = P

Equating:

1/p + 1/20 = 1/(p + 10) + 1/10

p2 + 10p - 200 = 0

Solving the quadratic;

d = [-10 +/-(102- 4(1)(200)1/2]/2 = (1/2)(-10 +/- 30)

Only the positive solution is relevant

d = (1/2)(-10 + 30) = 10 cm

Return