Let's define some magnitudes: $s_1$ = 15 m, first distance between object and camera $y_1'$ = 30 mm, size of image on camera at first take $s_2$ = 9 m, second distance between object and camera $y_2'$ = 51 mm, size of image on camera at second take
It's known that $\frac{1}{s_1}+\frac{}{s_1'}=\frac{1}{f}$(1) and the magnification is $\frac{y_1'}{y}=\frac{s_1'}{s_1}$(2) and for second take, magnification is $\frac{y_2'}{y}=\frac{s_2'}{s_2}$(3) and relation between distances also is given by: $\frac{1}{s_2}+\frac{1}{s_2'}=\frac{1}{f}$(4) where $y$ is real size of the object and $s_i'$ ($i$ = 1,2) are the image-camera distance for each take. Equaling (2) and (3): $\frac{y_1's_1}{s_1'}=\frac{y_2's_2}{s_2'}$(5) Equaling (1) and (4): $\frac{1}{s_1}+\frac{1}{s_1'}=\frac{1}{s_2}+\frac{1}{s_2'}$(6) Separating $s_2'$ from (5): $s_2' = \frac{y_2's_2s_1'}{y_1's_1}$(7) Putting (7) into (6): $\frac{1}{s_1'} = \frac{y_2'(s_1-s_2)}{s_1(y_2's_2-y_1's_1)}$(8) Substituting (8) into (1), and developing $f = \frac{y_2's_2-y_1's_1}{y_2'-y_1'} = 3/7\;\rm{m}$