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