In arithmetic progression sum of the n terms is given by
Sn = n/2[2a + ( n - 1 )d
= na + n^2d/2 - nd/2
Compare this equation with the given equation. You get
d/2 = p or d = 2p and
a - d/2 = q or a = p + q.
In the given equation r may be zero.
I am quite curious about this problem as I have definitely failed to understand my mistake. I have used a similar strategy for an easier problem where q, r and p were known ( p = 6, q = 5, r = 0 if it helps in any way ) and it worked perfectly for that one.