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