def func(a, b): if a <= 0 or b <= 0: return a + b if a > b: a %= b else: b %= a return func(a, b) print(func(7006652, 112307574))