ab = [int(x) for x in input().split()]

# Naive Algorithm
# m = min(ab)
# gcd = 1
# for i in range(2, int(m/2)):
#     if ab[0] % i == 0 and ab[1] % i == 0:
#         gcd = i
# print(gcd)

# Euclidean Algorithm
while True:
    min_i = ab.index(min(ab))
    max_i = ab.index(max(ab))
    r = ab[max_i] % ab[min_i]
    if r == 0:
        print(ab[min_i])
        break
    else:
        ab[max_i] = r int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x ab = [int(x) for x in input().split()] ab [int(x) for x in input().split()] while True:
    min_i = ab.index(min(ab))
    max_i = ab.index(max(ab))
    r = ab[max_i] % ab[min_i]
    if r == 0:
        print(ab[min_i])
        break
    else:
        ab[max_i] = r True min_i = ab.index(min(ab)) min_i ab.index(min(ab)) ab.index ab index min(ab) min ab max_i = ab.index(max(ab)) max_i ab.index(max(ab)) ab.index ab index max(ab) max ab r = ab[max_i] % ab[min_i] r ab[max_i] % ab[min_i] ab[max_i] ab max_i ab[min_i] ab min_i if r == 0:
        print(ab[min_i])
        break
    else:
        ab[max_i] = r r == 0 r 0 print(ab[min_i]) print ab[min_i] ab min_i break ab[max_i] = r ab[max_i] ab max_i r min_i = ab.index(min(ab)) ab.index(min(ab)) min_i max_i = ab.index(max(ab)) ab.index(max(ab)) max_i ab = [int(x) for x in input().split()] [int(x) for x in input().split()] ab r = ab[max_i] % ab[min_i] ab[max_i] % ab[min_i] r
ab = [int(x) for x in input().split()]

# Naive Algorithm
# m = min(ab)
# gcd = 1
# for i in range(2, int(m/2)):
#     if ab[0] % i == 0 and ab[1] % i == 0:
#         gcd = i
# print(gcd)

# Euclidean Algorithm
while True:
    min_i = ab.index(min(ab))
    max_i = ab.index(max(ab))
    r = ab[max_i] % ab[min_i]
    if r == 0:
        print(ab[min_i])
        break
    else:
        ab[max_i] = r