S has 5 elements, so P(S) has 25=32 subsets.
Total ordered pairs from P(S)×P(S) is 322=1024
For pairs (A,B) with A∩B=∅: each of the 5 elements has 3 choices - in A only, in B only, or in neither
Number of favorable outcomes = 35=243
Probability =1024243=21035
With p=5 and q=10, we get p+q=15