import sys


def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a
    
if __name__ == '__main__':
    ab = sys.stdin.readline()
    a, b = ab.split()
    a, b = int(a), int(b)
    
    sys.stdout.write(str(gcd(a, b)) + '\n') import sys sys 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 if __name__ == '__main__':
    ab = sys.stdin.readline()
    a, b = ab.split()
    a, b = int(a), int(b)
    
    sys.stdout.write(str(gcd(a, b)) + '\n') __name__ == '__main__' __name__ '__main__' ab = sys.stdin.readline() ab sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline a, b = ab.split() a ab.split() ab.split ab split b a, b = int(a), int(b) a int(a) int a b int(b) int b sys.stdout.write(str(gcd(a, b)) + '\n') sys.stdout.write sys.stdout sys stdout write str(gcd(a, b)) + '\n' str(gcd(a, b)) str gcd(a, b) gcd a b '\n' b = int(a), int(b) int(b) b a, b = ab.split() ab.split() a ab = sys.stdin.readline() sys.stdin.readline() ab 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 b = ab.split() ab.split() b a, b = int(a), int(b) int(a) a
import sys


def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a
    
if __name__ == '__main__':
    ab = sys.stdin.readline()
    a, b = ab.split()
    a, b = int(a), int(b)
    
    sys.stdout.write(str(gcd(a, b)) + '\n')