If $a<b<c<d$ and $x\in\mathbb R$ then what is the least value of the function $$f(x)=|x-a|+|x-b|+|x-c|+|x-d|\ ?$$
$f(x)= \begin{cases}
a-x+b-x+c-x+d-x & x\leq a \\
x-a+b-x+c-x+d-x & a< x\leq b \\
x-a+x-b+c-x+d-x & b< x\leq c \\
x-a+x-b+x-c+d-x & c< x\leq d \\
x-a+x-b+x-c+x-d & x> d
\end{cases}$
then $f'(x)=\begin{cases}
-4 & x\leq a \\
-2 & a< x\leq b \\
0 & b< x\leq c \\
2 & c< x\leq d \\
4 & x> d
\end{cases}$
From here on,i am stuck.Help me out