Let AB be the pole of height 'a' m and CD be the pole of height 'b' m and let the point of intersection of lines joining the topos of the poles be E and the its height be 'h' m. Let the perpendicular drawn from E be EF. Let DF = 'x' m and BF = 'y' m. As given in the question, BD = 'p' m
Consider triangles DEP and DAB. They will be similar by AAA similarity criteria. So
x/p = h/a ------------- (1)
Similarly triangles BFE and BDC are similar by AAA similarity. Hence
y/p = h/b -------------- (2)
Add (1) and (2)
x/p + y/p = h/a + h/b
=> (x+y)/p = (ha+hb)/ab
=> p/p = h(a+b)/ab
=> 1 = h(a+b)/ab
=> h = ab/(a+b)
Hope this solves your problem.