Solve for d p/d=q+r/d