Ferda and David meet in the elevator every day. One morning, they found that if they multiplied their current ages, they would get 238. If they did the same four years later, the product would be 378. Determine the sum of the current ages of Ferda and David.

(M. Petrová)

Hint. Could Ferda (or David) be 8, 15, or 47 years old?
The number 238 can be factored into the product of two numbers in the following ways:

$$
238=1 \cdot 238=2 \cdot 119=7 \cdot 34=14 \cdot 17 .
$$

Among these pairs are the current ages of Ferdy and David. After adding 4 to each of them, we should get a product of 378. Let's consider all possibilities:

$$
\begin{aligned}
(1+4) \cdot(238+4) & =1210 \\
(2+4) \cdot(119+4) & =738 \\
(7+4) \cdot(34+4) & =418 \\
(14+4) \cdot(17+4) & =378
\end{aligned}
$$

The only valid option is the last one - one of the boys is 14 years old, and the other is 17. The sum of the current ages of Ferdy and David is 31 years.

Note. Alternatively, the valid pair can be found using the factorizations of 378, which are:

$$
378=1 \cdot 378=2 \cdot 189=3 \cdot 126=6 \cdot 63=7 \cdot 54=9 \cdot 42=14 \cdot 27=18 \cdot 21 \text {. }
$$

The only pairs in the factorizations of 238 and 378 where both factors of the second factorization are 4 greater than those of the first are 14 and 17, respectively, 18 and 21.

Extreme values in the given factorizations can be excluded as unrealistic. If a solver excludes all possibilities based on this fact without considering all options, consider their approach correct.

Another solution. If we denote Ferdy's current age by \( f \) and David's current age by \( d \), then the information from the problem means

$$
f \cdot d=238 \quad \text { and } \quad(f+4) \cdot(d+4)=378 \text {. }
$$

After expanding the left side of the second condition and substituting the first condition, we get:

$$
\begin{aligned}
238+4 f+4 d+16 & =378 \\
4(f+d) & =124 \\
f+d & =31
\end{aligned}
$$

The sum of the current ages of Ferdy and David is 31 years.