def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

s=input().split()
a=int(s[0])
b=int(s[1])

y = gcd(a,b)
print(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 s=input().split() s input().split() ().split () input split a=int(s[0]) a int(s[0]) int s[0] s 0 b=int(s[1]) b int(s[1]) int s[1] s 1 y = gcd(a,b) y gcd(a,b) gcd a b print(y) print 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 = gcd(a,b) gcd(a,b) y a=int(s[0]) int(s[0]) a b=int(s[1]) int(s[1]) b s=input().split() input().split() s
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

s=input().split()
a=int(s[0])
b=int(s[1])

y = gcd(a,b)
print(y)