If the following is too general, don't worry about it. Suppose that we travel from $X$ to $Y$ and then back to $X$. Suppose that on the trip from $X$ to $Y$ we average $a$ miles per hour, and on the trip back we average $b$ miles per hour. What is our average speed for the whole trip?
Let the distance from $X$ to $Y$ be $d$ miles. The trip from $X$ to $Y$ then took $\dfrac{d}{a}$ hours. The trip back took $\dfrac{d}{b}$ hours. So the total travel time was $\dfrac{d}{a}+\dfrac{d}{b}$.
The total distance covered on our there and back trip was $2d$. The average speed for the whole trip is the distance covered divided by the time it took. So our average speed is $\frac{2d}{\frac{d}{a}+\frac{d}{b}}.\tag{$1$}$ Note that the $d$'s cancel. Our average speed is therefore $\frac{2}{\frac{1}{a}+\frac{1}{b}}\quad\text{or equivalently}\quad\frac{1}{\frac{\frac{1}{a}+\frac{1}{b}}{2}}.$ For calculation purposes, it is easier to use the equivalent expression $\frac{2ab}{a+b}.$ All of these are called the harmonic mean of $a$ and $b$. It has many uses.
Here is a similar problem. We spend $d$ dollars on wine that costs $a$ dollars per bottle, and $d$ dollars on wine that costs $b$ dollars per bottle. What is our average cost per bottle?
We got $\dfrac{d}{a}$ bottles of the $a$-dollar wine, and $\dfrac{d}{b}$ bottles of the $b$-dollar wine. So the total number of bottles that we got is $\dfrac{d}{a}+\dfrac{d}{b}$. We spent a total of $2d$ dollars. So our average cost per bottle is $\frac{2d}{\frac{d}{a}+\frac{d}{b}}.\tag{$2$}$ Note that $(2)$ is exactly the same expression as $(1)$. We don't need to take a trip to use the harmonic mean.