Solving for height and distance