from tools import number_theory def multi(): numerator, denominator = 1, 1 for a in range(1, 10): for b in range(1, 10): if a != b: if not ((10 * a * b) % (9 * a + b)): c = 10 * a * b // (9 * a + b) numerator *= 10 * a + b denominator *= 10 * b + c return denominator // number_theory.gcd(numerator, denominator) print(multi())