a,b = input().split() a = int(a) b = int(b) if b > a: a,b = b,a x = b while x >= 1: if a%x == 0 and b % x == 0: break x = x - 1 print(x)