def main() :
    x, y = [int(d) for d in input().split()]
    while y != 0 :
        x, y = y, x%y

    print(x)

if __name__ == '__main__' :
    main() def main() :
    x, y = [int(d) for d in input().split()]
    while y != 0 :
        x, y = y, x%y

    print(x) main int(d) for d in input().split() for d in input().split() d input().split() ().split () input split for d in input().split() int(d) int d x, y = [int(d) for d in input().split()] x [int(d) for d in input().split()] y while y != 0 :
        x, y = y, x%y

     y != 0 y 0 x, y = y, x%y x y y x%y x y print(x) print x if __name__ == '__main__' :
    main() __name__ == '__main__' __name__ '__main__' main() main def main() :
    x, y = [int(d) for d in input().split()]
    while y != 0 :
        x, y = y, x%y

    print(x) def main() :
    x, y = [int(d) for d in input().split()]
    while y != 0 :
        x, y = y, x%y

    print(x) main
def main() :
    x, y = [int(d) for d in input().split()]
    while y != 0 :
        x, y = y, x%y

    print(x)

if __name__ == '__main__' :
    main()