from fractions import Fraction s1 = Fraction(19, 47) s2 = Fraction(28, 43) answer = str((s1 + s2) / 27).split("/") print(answer[0])