#16D8101023J 久保田凌弥 kubotarouxxx python3

x,y=map(int, input().split())

if x>y:
  while 1:
   if (x%y)==0:
    print(y)
    break
   a=x%y
   x=y
   y=a
else:
  while 1:
   if (y%x)==0:
    print(x)
    break
   a=y%x
   y=x
   x=a
 x,y=map(int, input().split()) x map(int, input().split()) map int input().split() ().split () input split y if x>y:
  while 1:
   if (x%y)==0:
    print(y)
    break
   a=x%y
   x=y
   y=a
else:
  while 1:
   if (y%x)==0:
    print(x)
    break
   a=y%x
   y=x
   x=a x>y x y while 1:
   if (x%y)==0:
    print(y)
    break
   a=x%y
   x=y
   y=a 1 if (x%y)==0:
    print(y)
    break
    (x%y)==0 x%y x y 0 print(y) print y break a=x%y a x%y x y x=y x y y=a y a while 1:
   if (y%x)==0:
    print(x)
    break
   a=y%x
   y=x
   x=a 1 if (y%x)==0:
    print(x)
    break
    (y%x)==0 y%x y x 0 print(x) print x break a=y%x a y%x y x y=x y x x=a x a x,y=map(int, input().split()) map(int, input().split()) x y=map(int, input().split()) map(int, input().split()) y y=a a y y=x x y x=a a x a=y%x y%x a x=y y x a=x%y x%y a
#16D8101023J 久保田凌弥 kubotarouxxx python3

x,y=map(int, input().split())

if x>y:
  while 1:
   if (x%y)==0:
    print(y)
    break
   a=x%y
   x=y
   y=a
else:
  while 1:
   if (y%x)==0:
    print(x)
    break
   a=y%x
   y=x
   x=a

