\[x\ км - горизонтальный\ путь;\]
\[y\ км - путь\ в\ гору\ (с\ горы).\]
\[\left\{ \begin{matrix} \frac{x}{12} + \frac{y}{7} = 3\ \ \ \ \ \ (1) \\ \frac{x}{12} + \frac{y}{14} = 2\ \ \ (2) \\ \end{matrix} \right.\ \]
\[(1) - (2):\ \ \ \frac{y}{14} = 1 \Longrightarrow y = 14.\]
\[\left\{ \begin{matrix} y = 14\ \ \ \ \ \ \ \ \ \ \\ \frac{x}{12} + \frac{14}{14} = 2 \\ \end{matrix} \right.\ \text{\ \ \ \ \ \ \ \ \ \ }\]
\[\left\{ \begin{matrix} y = 14\ \ \ \ \ \ \ \\ \frac{x}{12} + 1 = 2 \\ \end{matrix} \right.\ \text{\ \ \ \ \ \ \ \ }\]
\[\left\{ \begin{matrix} y = 14 \\ \frac{x}{12} = 1 \\ \end{matrix} \right.\ \text{\ \ \ \ \ \ \ \ }\]
\[\left\{ \begin{matrix} y = 14 \\ x = 12 \\ \end{matrix} \right.\ \]
\[14 + 12 = 26\ км.\]
\[Ответ:26\ км.\]