def gcd(a,b): while b: a,b =b,a%b return a a,b=input().split() a,b=int(a),int(b) if a<b: a,b=b,a res=gcd(a,b) print(res)