def gcd(x,y):
   if x<=y:
     tmp=x
     x=y
     y=tmp
   r=x%y
   while(r!=0):
     x=y
     y=r
     r=x%y
   return y
a=input().split()
b=[int(i) for i in a]
print(gcd(b[0],b[1]))
 def gcd(x,y):
   if x<=y:
     tmp=x
     x=y
     y=tmp
   r=x%y
   while(r!=0):
     x=y
     y=r
     r=x%y
   return y gcd if x<=y:
     tmp=x
     x=y
     y=tmp
    x<=y x y tmp=x tmp x x=y x y y=tmp y tmp r=x%y r x%y x y while(r!=0):
     x=y
     y=r
     r=x%y
    r!=0 r 0 x=y x y y=r y r r=x%y r x%y x y return y y x x y y a=input().split() a input().split() ().split () input split int(i) for i in a for i in a i a for i in a int(i) int i b=[int(i) for i in a] b [int(i) for i in a] print(gcd(b[0],b[1])) print gcd(b[0],b[1]) gcd b[0] b 0 b[1] b 1 b=[int(i) for i in a] [int(i) for i in a] b def gcd(x,y):
   if x<=y:
     tmp=x
     x=y
     y=tmp
   r=x%y
   while(r!=0):
     x=y
     y=r
     r=x%y
   return y def gcd(x,y):
   if x<=y:
     tmp=x
     x=y
     y=tmp
   r=x%y
   while(r!=0):
     x=y
     y=r
     r=x%y
   return y gcd a=input().split() input().split() a
def gcd(x,y):
   if x<=y:
     tmp=x
     x=y
     y=tmp
   r=x%y
   while(r!=0):
     x=y
     y=r
     r=x%y
   return y
a=input().split()
b=[int(i) for i in a]
print(gcd(b[0],b[1]))

