#49962: python


nnic52136@gmail.com (李Rr)


import math

a, b = map(int, input().split())
print(math.gcd(a, b))