Compute the following expression:  
\[ \sum_{i=0}^{\frac{q-1}{2}}\left\lfloor\frac{ip}{q}\right\rfloor + \sum_{j=0}^{\frac{p-1}{2}}\left\lfloor\frac{jq}{p}\right\rfloor \]  
where \( p = 51 \) and \( q = 81 \).

Let's think step by step and output the final answer within \boxed{}.
user