The lens formula is given as $\frac{1}{f} = \frac{1}{v} - \frac{1}{u}$, where $f$ - focal length, $u$- object distance from the lens and $v$- image distance from the lens. The lens formula is implemented with proper sign convention using cartesian method.