a,b=[int(i) for i in input().split(" ")]

while b!=0:
    t = min(a,b)
    b = max(a,b) % min(a,b)
    a = t
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 a,b=[int(i) for i in input().split(" ")] a [int(i) for i in input().split(" ")] b while b!=0:
    t = min(a,b)
    b = max(a,b) % min(a,b)
    a = t b!=0 b 0 t = min(a,b) t min(a,b) min a b b = max(a,b) % min(a,b) b max(a,b) % min(a,b) max(a,b) max a b min(a,b) min a b a = t a t print(a) print a a,b=[int(i) for i in input().split(" ")] [int(i) for i in input().split(" ")] a b=[int(i) for i in input().split(" ")] [int(i) for i in input().split(" ")] b b = max(a,b) % min(a,b) max(a,b) % min(a,b) b t = min(a,b) min(a,b) t a = t t a
a,b=[int(i) for i in input().split(" ")]

while b!=0:
    t = min(a,b)
    b = max(a,b) % min(a,b)
    a = t
print(a)