Yes. We have to take exact distance mentioned in the question. But we have to consider the sign convention.
for convex mirror focal length positive and for concave mirror focal length is negative.
The direction light rays distance is positive and in opposite direction distance is negative.
Height along upwards positive , downwards negative.