#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_B&lang=jp
#??????????????????????????????
#?????§??¬?´???°???????????????????????????????????¨????????¨?¨????????????????
def gcd(x,y):
    
    if y > x:
        x, y = y, x

    while not y == 0:
        x, y = y, x % y
    
    return x
def main():
    target = [int(a) for a in input().split()]
    print(gcd(target[0], target[1]))
    
if __name__ == "__main__":
    main() def gcd(x,y):
    
    if y > x:
        x, y = y, x

    while not y == 0:
        x, y = y, x % y
    
    return x gcd if y > x:
        x, y = y, x

     y > x y x x, y = y, x x y y x while not y == 0:
        x, y = y, x % y
    
     not y == 0 y == 0 y 0 x, y = y, x % y x y y x % y x y return x x x x y y def main():
    target = [int(a) for a in input().split()]
    print(gcd(target[0], target[1]))
     main int(a) for a in input().split() for a in input().split() a input().split() ().split () input split for a in input().split() int(a) int a target = [int(a) for a in input().split()] target [int(a) for a in input().split()] print(gcd(target[0], target[1])) print gcd(target[0], target[1]) gcd target[0] target 0 target[1] target 1 if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def gcd(x,y):
    
    if y > x:
        x, y = y, x

    while not y == 0:
        x, y = y, x % y
    
    return x def gcd(x,y):
    
    if y > x:
        x, y = y, x

    while not y == 0:
        x, y = y, x % y
    
    return x gcd def main():
    target = [int(a) for a in input().split()]
    print(gcd(target[0], target[1]))
     def main():
    target = [int(a) for a in input().split()]
    print(gcd(target[0], target[1]))
     main
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_B&lang=jp
#??????????????????????????????
#?????§??¬?´???°???????????????????????????????????¨????????¨?¨????????????????
def gcd(x,y):
    
    if y > x:
        x, y = y, x

    while not y == 0:
        x, y = y, x % y
    
    return x
def main():
    target = [int(a) for a in input().split()]
    print(gcd(target[0], target[1]))
    
if __name__ == "__main__":
    main()