Use the fact that
$$\arctan{\left ( \frac{p}{q} \right )} + \arctan{\left ( \frac{q}{p} \right )} = \frac{\pi}{2} $$
So all you need to do is arrange the sum to exploit the symmetry you need, i.e., $(p,q) \mapsto (q,p)$.
To do this without repeating, start on the bottom/left axes; there are $9$ non-diagonal points each, so the sum along there is $9 \pi/2$.
Then move one row up/column over to the right; we now have only $8$ (so we don't repeat). Keep moving up/right and get
$$(9+8+7+\cdots+1) \frac{\pi}{2} = 45 \frac{\pi}{2}$$
Now add in the diagonals, $10$ of them, contributing $\pi/4$ each (i.e., $\arctan{1}$), so the sum is
$$45 \frac{\pi}{2} + 10 \frac{\pi}{4} = 25 \pi$$