def gcd(x,y):
  x,y=max(x,y),min(x,y)
  if y==0:
    return x
  else:
    return gcd(y, x%y)

a,b=map(int,input().split())
ans=gcd(a,b)
print(ans) def gcd(x,y):
  x,y=max(x,y),min(x,y)
  if y==0:
    return x
  else:
    return gcd(y, x%y) gcd x,y=max(x,y),min(x,y) x max(x,y) max x y y min(x,y) min x y if y==0:
    return x
  else:
    return gcd(y, x%y) y==0 y 0 return x x return gcd(y, x%y) gcd(y, x%y) gcd y x%y x y x x y y a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b ans=gcd(a,b) ans gcd(a,b) gcd a b print(ans) print ans b=map(int,input().split()) map(int,input().split()) b ans=gcd(a,b) gcd(a,b) ans a,b=map(int,input().split()) map(int,input().split()) a def gcd(x,y):
  x,y=max(x,y),min(x,y)
  if y==0:
    return x
  else:
    return gcd(y, x%y) def gcd(x,y):
  x,y=max(x,y),min(x,y)
  if y==0:
    return x
  else:
    return gcd(y, x%y) gcd
def gcd(x,y):
  x,y=max(x,y),min(x,y)
  if y==0:
    return x
  else:
    return gcd(y, x%y)

a,b=map(int,input().split())
ans=gcd(a,b)
print(ans)
