f, the focal length, is positive for a concave mirror, and negative for a convex mirror. When the image distance is positive, the image is on the same side of the mirror as the object, and it is real and inverted. When the image distance is negative, the image is behind the mirror, so the image is virtual and upright.