from sys import stdin
 
x, y = [int(x) for x in stdin.readline().rstrip().split()]
 
def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a
 
print(gcd(x, y)) from sys import stdin int(x) for x in stdin.readline().rstrip().split() for x in stdin.readline().rstrip().split() x stdin.readline().rstrip().split() stdin.readline().rstrip().split stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip split for x in stdin.readline().rstrip().split() int(x) int x x, y = [int(x) for x in stdin.readline().rstrip().split()] x [int(x) for x in stdin.readline().rstrip().split()] y def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a
  gcd while b > 0:
        a, b = b, a % b
     b > 0 b 0 a, b = b, a % b a b b a % b a b return a a a a b b print(gcd(x, y)) print gcd(x, y) gcd x y x, y = [int(x) for x in stdin.readline().rstrip().split()] [int(x) for x in stdin.readline().rstrip().split()] x def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a
  def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a
  gcd y = [int(x) for x in stdin.readline().rstrip().split()] [int(x) for x in stdin.readline().rstrip().split()] y
from sys import stdin
 
x, y = [int(x) for x in stdin.readline().rstrip().split()]
 
def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a
 
print(gcd(x, y))
