Consider two irreducible fractions:
$r_1 = \frac{p_1}{q_1}$
$r_2 = \frac{p_2}{q_2}$
with $r_1 \ge 0$ and $r_2 \ge 0$.
How the modulo $\%$ is defined over rational numbers (I think that is $r_3$ such that $r_1 = r_2 \times n + r_3$ with $n$ a positive integer but I am not sure of that), and how to compute the numerator $p_3$ and the denominator $q_3$ from $p_1, q_1, p_2, q_2$ and using only the following operations on integers: $+, -, \times, /, \%, \text{gcd}(), \text{lcm}()$ ?