Reducing fractions to their lowest term