Four. (20 points) Transporting goods from a riverside city $A$ to another location $B$, where the nearest point $C$ on the riverbank to $B$ is $b$ kilometers away, and the distance from $A$ to $C$ along the river is $a$ kilometers. If the waterway transportation cost is $\frac{1}{n}$ of the highway transportation cost (where $n$ is a real number greater than 1), explain how to construct a highway from point $B$ to the riverbank to minimize the total transportation cost from $A$ to $B$.
As shown in Figure 4, suppose a road is built from point $B$ to point $D$, i.e., $BD$ is the road, and then from point $D$ to point $A$ is changed to water transport, then we have
$$
\begin{array}{l}
A D=a-b \tan \varphi, \\
C D=b \tan \varphi, \\
B D=\frac{b}{\cos \varphi} .
\end{array}
$$

Thus, according to the problem, we get
$$
\begin{aligned}
S & =n k \cdot \frac{b}{\cos \varphi}+k(a-b \tan \varphi) \\
& =b k\left(\frac{n}{\cos \varphi}-\tan \varphi\right)+k a,
\end{aligned}
$$

where $k$ is the cost per kilometer of water transport.
Let $x=\sin \varphi, \cos \varphi=\sqrt{1-x^{2}}, \tan \varphi=$ $\frac{x}{\sqrt{1-x^{2}}}$, then let $y=\frac{n}{\cos \varphi}-\tan \varphi$ we get $y=\frac{n-x}{\sqrt{1-x^{2}}}$. Therefore,
$$
\left(1+y^{2}\right) x^{2}-2 n x+\left(n^{2}-y^{2}\right)=0 .
$$

Since $x$ is a real number, we have
$$
\Delta=(2 n)^{2}-4\left(1+y^{2}\right)\left(n^{2}-y^{2}\right) \geqslant 0,
$$

which means $y \geqslant \sqrt{n^{2}-1}$.
Thus, the minimum value of $y$ is $\sqrt{n^{2}-1}$. At this point, $x=\frac{1}{n}$,

i.e., $\sin \varphi=\frac{1}{n}$.
Therefore, $A D=a-\frac{b}{\sqrt{n^{2}-1}}, B D=\frac{n b}{\sqrt{n^{2}-1}}$, which minimizes the total transportation cost from $A$ to $B$, and the minimum value is
$$
S=k b \sqrt{n^{2}-1}+k a .
$$