list=[int(i) for i in input().split()]



if list[0]>list[1]:
    a=list[0]
    b=list[1]
else:
    b=list[0]
    a=list[1]    


if a%b==0:
    print(b)
else:
    while b>0:
        c=a%b
        a=b
        b=c
    print(a) int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i list=[int(i) for i in input().split()] list [int(i) for i in input().split()] if list[0]>list[1]:
    a=list[0]
    b=list[1]
else:
    b=list[0]
    a=list[1]     list[0]>list[1] list[0] list 0 list[1] list 1 a=list[0] a list[0] list 0 b=list[1] b list[1] list 1 b=list[0] b list[0] list 0 a=list[1] a list[1] list 1 if a%b==0:
    print(b)
else:
    while b>0:
        c=a%b
        a=b
        b=c
    print(a) a%b==0 a%b a b 0 print(b) print b while b>0:
        c=a%b
        a=b
        b=c
     b>0 b 0 c=a%b c a%b a b a=b a b b=c b c print(a) print a c=a%b a%b c a=b b a list=[int(i) for i in input().split()] [int(i) for i in input().split()] list b=list[1] list[1] b b=c c b b=list[0] list[0] b a=list[1] list[1] a a=list[0] list[0] a
list=[int(i) for i in input().split()]



if list[0]>list[1]:
    a=list[0]
    b=list[1]
else:
    b=list[0]
    a=list[1]    


if a%b==0:
    print(b)
else:
    while b>0:
        c=a%b
        a=b
        b=c
    print(a)
