4. For the convex pentagon $A B C D E$, the side lengths are sequentially $a_{1}, a_{2}, a_{3}, a_{4}, a_{5}$. It is known that a quadratic trinomial in $x$ satisfies:

When $x=a_{1}$ and $x=a_{2}+a_{3}+a_{4}+a_{5}$, the value of the quadratic trinomial is 5;
When $x=a_{1}+a_{2}$, the value of the quadratic trinomial is $p$;
When $x=a_{3}+a_{4}+a_{5}$, the value of the quadratic trinomial is $q$.
Then $p-q=$ $\qquad$
4. 0 .

Let the quadratic trinomial be
$$
f(x)=a x^{2}+b x+c(a \neq 0) \text {, }
$$

and let the axis of symmetry of its graph be $x=x_{0}$.
By the problem, we know
$$
f\left(a_{1}\right)=f\left(a_{2}+a_{3}+a_{4}+a_{5}\right)=5,
$$

and $\square$
$$
\begin{array}{l}
a_{1} \neq a_{2}+a_{3}+a_{4}+a_{5} . \\
\text { Hence } a_{1}+\left(a_{2}+a_{3}+a_{4}+a_{5}\right)=2 x_{0} \\
\Rightarrow\left(a_{1}+a_{2}\right)+\left(a_{3}+a_{4}+a_{5}\right)=2 x_{0} \\
\Rightarrow f\left(a_{1}+a_{2}\right)=f\left(a_{3}+a_{4}+a_{5}\right) \\
\Rightarrow p=q \Rightarrow p-q=0 .
\end{array}
$$