5. Given the function $f(x)=\frac{\left(2^{x}+1\right)^{2}}{2^{x} x}+1$ on the interval $[-2018,0) \cup(0,2018]$, the maximum value is $M$ and the minimum value is $N$. Then $M+N=(\quad)$.
(A) 3
(B) 2
(C) 1
(D) 0