Find two numbers such that when each is divided by the other, the sum is in a given ratio to the difference.
Let the first number be of the form $z+a$, then the second is $p z-a$. These two numbers satisfy the first condition, because if the first gives $a$ to the other, the sum becomes $p z$, which is $p$ times larger than the remainder $z$ of the first. If the second gives $b$ to the first, thereby becoming $q$ times larger, then

$$
z+a+b=q(p z-a-b)
$$

from which

$$
z=(a+b) \frac{q+1}{p q-1}
$$