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