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

if x > y:
    larger = x
    smaller = y
else:
    larger = y
    smaller = x

while True:
    quot, rem = divmod(larger, smaller)  # a > b ?????????
    larger = smaller
    smaller = rem
    if rem == 0:
        gcd = larger
        break

print(gcd)

pass x, y = map(int, input().split()) x map(int, input().split()) map int input().split() ().split () input split y if x > y:
    larger = x
    smaller = y
else:
    larger = y
    smaller = x x > y x y larger = x larger x smaller = y smaller y larger = y larger y smaller = x smaller x while True:
    quot, rem = divmod(larger, smaller)  # a > b ?????????
    larger = smaller
    smaller = rem
    if rem == 0:
        gcd = larger
        break True quot, rem = divmod(larger, smaller) quot divmod(larger, smaller) divmod larger smaller rem larger = smaller larger smaller smaller = rem smaller rem if rem == 0:
        gcd = larger
        break rem == 0 rem 0 gcd = larger gcd larger break print(gcd) print gcd smaller = x x smaller larger = y y larger x, y = map(int, input().split()) map(int, input().split()) x y = map(int, input().split()) map(int, input().split()) y quot, rem = divmod(larger, smaller) divmod(larger, smaller) quot larger = x x larger rem = divmod(larger, smaller) divmod(larger, smaller) rem smaller = rem rem smaller larger = smaller smaller larger gcd = larger larger gcd smaller = y y smaller
x, y = map(int, input().split())

if x > y:
    larger = x
    smaller = y
else:
    larger = y
    smaller = x

while True:
    quot, rem = divmod(larger, smaller)  # a > b ?????????
    larger = smaller
    smaller = rem
    if rem == 0:
        gcd = larger
        break

print(gcd)

pass