print(__import__('math').gcd(*list(map(int, input().split()))))