<s>[INST] Need to require a assertion for two subsets of natural numbers Let $P\ne Q$ be an arbitrary pair of primes, $M=PQ$.
$S$ = sum of all $m<M$ co-prime to $M$ such that equation $Px+Qy=m\ (1)$ has a solutions in natural numbers.
$s$ = sum of all $m<M$ co-prime to $M$ such that this equation is not solvable.
Is the assertion $S-s=\dfrac{(P^2-1)(Q^2-1)}{6}$  right?  
 [/INST] Consider the set
$$T = \{ (x,y)\ :\ 1\leq x\leq Q,\ 1\leq y\leq P,\ Px+Qy\leq PQ\}.$$
It is easy to see that
$$S = \sum_{(x,y)\in T} (Px+Qy).$$
Switching to double summation in $S$, we get
$$S = \sum_{y=1}^{P} \sum_{x=1}^{X_y} (Px+Qy) = \sum_{y=1}^{P} QyX_y + P\frac{X_y(X_y+1)}2,$$
where 
$$X_y = \left\lfloor \frac{PQ-Qy}P\right\rfloor = Q + \frac{-Qy - Z_y}P$$
and
$$Z_y = -Qy\bmod P.$$
Hence,
$$S=\sum_{y=1}^{P} \left(\frac{PQ^2+PQ}2 - \frac{Q}{2}y - (Q+\frac{1}{2})Z_y + \frac{1}{2P}Z_y^2 - \frac{Q^2}{2P}y^2\right).$$
Since $(P,Q)=1$, $Z_y$ runs over $\{0,1,\dots,P-1\}$ when $y$ runs over $\{1,2,\dots,P\}$.
Therefore,
$$S = \frac{P^2Q^2+P^2Q}2-\frac{QP(P+1)}{2}-(Q+\frac{1}{2})\frac{P(P-1)}2+\frac{(P-1)P(2P-1)}{12P}-\frac{Q^2P(P+1)(2P+1)}{12P}$$
$$=\frac{(P-1)(Q-1)(4PQ+P+Q+1)}{12}.$$

Now, the sum of all $m<PQ$ coprime to $PQ$ equals
$$S+s=\frac{PQ(PQ-1)}2 - P\frac{Q(Q-1)}2 - Q\frac{P(P-1)}2=\frac{PQ(P-1)(Q-1)}2,$$
implying that
$$s = \frac{PQ(P-1)(Q-1)}2 - S = \frac{(P-1)(Q-1)(2PQ-P-Q-1)}{12}.$$
Finally,
$$S-s = \frac{(P-1)(Q-1)(4PQ+P+Q+1)}{12} - \frac{(P-1)(Q-1)(2PQ-P-Q-1)}{12}$$
$$=\frac{(P^2-1)(Q^2-1)}6$$
as expected.
</s>