def main():
    x, y = map(int, input().split())
    print(gcd(x, y))

def gcd(x, y):
    if(x < y):
        x, y = y, x
    while True:
        if(y == 0):
            return x
        else:
            x, y = y, x%y

if __name__ == '__main__':
    main() def main():
    x, y = map(int, input().split())
    print(gcd(x, y)) main x, y = map(int, input().split()) x map(int, input().split()) map int input().split() ().split () input split y print(gcd(x, y)) print gcd(x, y) gcd x y def gcd(x, y):
    if(x < y):
        x, y = y, x
    while True:
        if(y == 0):
            return x
        else:
            x, y = y, x%y gcd if(x < y):
        x, y = y, x
     x < y x y x, y = y, x x y y x while True:
        if(y == 0):
            return x
        else:
            x, y = y, x%y True if(y == 0):
            return x
        else:
            x, y = y, x%y y == 0 y 0 return x x x, y = y, x%y x y y x%y x y x x y y if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def gcd(x, y):
    if(x < y):
        x, y = y, x
    while True:
        if(y == 0):
            return x
        else:
            x, y = y, x%y def gcd(x, y):
    if(x < y):
        x, y = y, x
    while True:
        if(y == 0):
            return x
        else:
            x, y = y, x%y gcd def main():
    x, y = map(int, input().split())
    print(gcd(x, y)) def main():
    x, y = map(int, input().split())
    print(gcd(x, y)) main
def main():
    x, y = map(int, input().split())
    print(gcd(x, y))

def gcd(x, y):
    if(x < y):
        x, y = y, x
    while True:
        if(y == 0):
            return x
        else:
            x, y = y, x%y

if __name__ == '__main__':
    main()