def gcd(a, b):
	while b:
		a, b = b, a%b
	return a
x, y = map(int,input().split())
print(gcd(x, y)) def gcd(a, b):
	while b:
		a, b = b, a%b
	return a gcd while b:
		a, b = b, a%b
	 b a, b = b, a%b a b b a%b a b return a a a a b b x, y = map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split y print(gcd(x, y)) print gcd(x, y) gcd x y def gcd(a, b):
	while b:
		a, b = b, a%b
	return a def gcd(a, b):
	while b:
		a, b = b, a%b
	return a gcd y = map(int,input().split()) map(int,input().split()) y x, y = map(int,input().split()) map(int,input().split()) x
def gcd(a, b):
	while b:
		a, b = b, a%b
	return a
x, y = map(int,input().split())
print(gcd(x, y))