Rays coming from very far away are practically parallel. If such rays are also parallel to the main axis of the lens, the image forms at f, the focal point of the lens will be real and inverted.
The general method implies that, the relation between the object distance p, the image distance q, and the focal length f is given by the thin lens formula as:
And the power of this lens will be obtained from: