The point which is common to all the three medians is called the centroid and this point divides each median in the ratio 2:1.
Now, apply the section formula
m1=2
m2=1
x1 = 2 y1 = 1
x2 = 32 y2 = 52
You will get (p,q)=(22,35)
p=22 q=35
p-q
=22-35
= -12.