def gcd(a,b): a,b=max(a,b),min(a,b) while a%b: a,b=b,a%b return b a,b=map(int,input()) print(gcd(a,b))