def division(x,y):
    if y == 0:
        return x
    return division(y, x%y)

x,y=map(int,input().split())

kotae = division(x,y)
print(kotae) def division(x,y):
    if y == 0:
        return x
    return division(y, x%y) division if y == 0:
        return x
     y == 0 y 0 return x x return division(y, x%y) division(y, x%y) division y x%y x y x x y y x,y=map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split y kotae = division(x,y) kotae division(x,y) division x y print(kotae) print kotae x,y=map(int,input().split()) map(int,input().split()) x y=map(int,input().split()) map(int,input().split()) y kotae = division(x,y) division(x,y) kotae def division(x,y):
    if y == 0:
        return x
    return division(y, x%y) def division(x,y):
    if y == 0:
        return x
    return division(y, x%y) division
def division(x,y):
    if y == 0:
        return x
    return division(y, x%y)

x,y=map(int,input().split())

kotae = division(x,y)
print(kotae)