Assume requests are independent. Denote the number of unsuccessful requests until the $r$th success by $X$. Then $X$ has a negative binomial distribution, $P(X=k) = {k+r-1 \choose k} p^{r-1}(1-p)^kp $ because in the first $k+r-1$ attempts there are $k$ failures and $r-1$ successes, while the $(k+r)$-th attempt is successful.
$X$ has the same distribution as the sum of $r$ independent geometrically distributed random variables, thus its expectation is $\mathrm{E}X= r\cdot(1-p)/p$.
Now for the waiting time $Y$. Clearly $Y = rm + Xf$. Thus $\mathrm{E}Y = rm +\mathrm{E}Xf$. Plugging in $\mathrm{E}X$ gives $\mathrm{E}Y = rm + (r(1-p)/p)f$. Plug in $r=5$ to finish.