
def gcd(a,b):
  if a<b: a,b=b,a
  c=a%b
  if c==0:
    print(b)
  else:
    return gcd(b,c)

a,b = map(int, input().split())
gcd(a,b) def gcd(a,b):
  if a<b: a,b=b,a
  c=a%b
  if c==0:
    print(b)
  else:
    return gcd(b,c) gcd if a<b: a,b=b,a
   a<b a b c=a%b c a%b a b if c==0:
    print(b)
  else:
    return gcd(b,c) c==0 c 0 print(b) print b return gcd(b,c) gcd(b,c) gcd b c a a b b a,b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b gcd(a,b) gcd a b a,b = map(int, input().split()) map(int, input().split()) a b = map(int, input().split()) map(int, input().split()) b def gcd(a,b):
  if a<b: a,b=b,a
  c=a%b
  if c==0:
    print(b)
  else:
    return gcd(b,c) def gcd(a,b):
  if a<b: a,b=b,a
  c=a%b
  if c==0:
    print(b)
  else:
    return gcd(b,c) gcd

def gcd(a,b):
  if a<b: a,b=b,a
  c=a%b
  if c==0:
    print(b)
  else:
    return gcd(b,c)

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