def gcd(a, c): while c != 0: a, c = c, a % c return a a, c = map(int, input().split()) print(gcd(a, c))