Let $x$ and $y$ be positive real numbers.  Find the minimum value of
\[\left( x + \frac{1}{y} \right) \left( x + \frac{1}{y} + 2018 \right) + \left( y + \frac{1}{x} \right) \left( y + \frac{1}{x} + 2018 \right).\]
By QM-AM,
\[\sqrt{\frac{(x + \frac{1}{y})^2 + (y + \frac{1}{x})^2}{2}} \ge \frac{(x + \frac{1}{y}) + (y + \frac{1}{x})}{2},\]so
\[\left( x + \frac{1}{y} \right)^2 + \left( y + \frac{1}{x} \right)^2 \ge \frac{1}{2} \left( x + \frac{1}{y} + y + \frac{1}{x} \right)^2.\]Then
\begin{align*}
&\left( x + \frac{1}{y} \right) \left( x + \frac{1}{y} + 2018 \right) + \left( y + \frac{1}{x} \right) \left( y + \frac{1}{x} + 2018 \right) \\
&= \left( x + \frac{1}{y} \right)^2 + \left( y + \frac{1}{x} \right)^2 + 2018 \left( x + \frac{1}{y} \right) + 2018 \left( y + \frac{1}{x} \right) \\
&\ge \frac{1}{2} \left( x + \frac{1}{y} + y + \frac{1}{x} \right)^2 + 2018 \left( x + \frac{1}{y} + y + \frac{1}{x} \right) \\
&= \frac{1}{2} u^2 + 2018u,
\end{align*}where $u = x + \frac{1}{y} + y + \frac{1}{x}.$

By AM-GM,
\[u = x + \frac{1}{x} + y + \frac{1}{y} \ge 2 + 2 = 4.\]The function $\frac{1}{2} u^2 + 2018u$ is increasing for $u \ge 4,$ so
\[\frac{1}{2}u^2 + 2018u \ge \frac{1}{2} \cdot 4^2 + 2018 \cdot 4 = 8080.\]Equality occurs when $x = y = 1,$ so the minimum value is $\boxed{8080}.$