from fractions import Fraction a = (Fraction(19, 47) + Fraction(28, 43)) / 27 print(a.numerator)