Convex continuous piecewise linear function form

Let $$n\in \mathbb{N}$$ and $$\mathcal{E}_n$$ the set of functions $$f$$ of the form $$f(x)=b_0+b_1x+\sum_{i=1}^n a_i\left\lvert x-r_i\right\rvert$$ for $$b_0,b_1\in\mathbb{R},a_1,\dots,a_n>0$$ and $$r_1,\dots,r_n\in\mathbb{R}$$.

Show that if $$f$$ is a convex continuous piecewise linear function, then there exists $$n\in\mathbb{N}$$ such that $$f\in\mathcal{E}_n$$.

This result does not seem clear to me, and I do not know how to prove it.

Here is my proof for this.

Let $$k_1<\dots k_n\in\mathbb{R}$$ such that $$f$$ is linear on $$\left]k_i,k_{i+1}\right[$$ for all $$1\leqslant i\leqslant n-1$$ and $$f$$ is linear on $$\left]-\infty,k_1\right[$$ and on $$\left]k_n,+\infty\right[$$.

Let $$c_i$$ be the slope of $$f$$ on $$\left[ k_i,k_{i+1}\right[$$ for all $$0\leqslant i\leqslant n$$ with the convention $$k_0=-\infty$$ and $$k_{n+1}=+\infty$$.

As $$f$$ is convex, we have $$c_0\leqslant c_1\leqslant\dots\leqslant c_{n+1}$$. Let $$a_i=\frac{1}{2}\left(c_i-c_{i-1}\right)$$ for $$1\leqslant i\leqslant n$$. Indeed, in the formula $$x\mapsto b_0+b_1+\sum_i\left\lvert x-k_i\right\rvert$$, the jump of the derivative in $$x=k_i$$ is $$2a_i$$.

Let $$b_1$$ such that $$b_i+\sum_{i=1}^na_i=c_n$$ that is $$b_1=\frac{1}{2}\left(c_n+c_o\right)$$.

As such, the two applications $$f$$ and $$x\mapsto b_1x+\sum_{i=1}^na_i\left\lvert x-k_i\right\rvert$$ are two linear functions on every intervals $$\left]k_{i-1},k_i\right[$$ for $$1\leqslant i\leqslant n+1$$, continuous and with the same slope on every interval by construction.

That is the two applications differ by a constant, named $$b_0$$. Thus, $$f\in \mathcal{E}_n$$.