import math A, B = map(int, input().split()) ans = math.gcd(A, B) print(ans)