def input_list(): return list(map(int, input().split())) def gcd(s1, s2): if (s1 % s2 == 0): return s2 else: return gcd(s2, s1 % s2) a = input_list() print(gcd(a[0], a[1]))