First note that it is easier to find number of pairs such that is divisible by 24.

There are 10 primes less than 30.So in total we have 10*10=100 pairs of primes.

Next we find pairs with the desired property.

It is quite obvious that .......(*)

If 24 divides the above summation then both 3 and 8 divide the summation.

Suppose (mod 3) (mod 3),which is not possible.

(mod 3).......(1)

This also implies . We make use of this property that q is odd later.

Consider following cases:

Case I: (mod 8)

(mod 8) [From Equation (*)]

This along with Equation (1) gives p=17 and q=5,13,29

Case II: (mod 8)

(mod 8)

(mod 8)

This along with Equation (1) gives p=11 and q=5,13,17,29

Case III: (mod 8)

(mod 8)

(mod 8)

This along with Equation (1) gives p=5,29 and q=5,13,29

Case IV: (mod 8)

(mod 8)

This along with equation (1) gives p=23 and q=3,5,7,11,13,17,19,23,29

Total number of pairs=22

So your answer would be 100-22=78.

Please note that if p and q are taken to be distinct,then answer would be (10)(9)-(19)=71.

Please notify me if you don't understand something or find something wrong.