def cgd(x,y):
	while(True):
		r=x%y
		if r==0:
			m=y
			break
		x=y
		y=r
	
	return m

a,b=map(int,input().split())
if a>b:
	m=cgd(a,b)
elif a<b:
	m=cgd(b,a)
else:
	m=a
print(m)
	 def cgd(x,y):
	while(True):
		r=x%y
		if r==0:
			m=y
			break
		x=y
		y=r
	
	return m cgd while(True):
		r=x%y
		if r==0:
			m=y
			break
		x=y
		y=r
	
	 True r=x%y r x%y x y if r==0:
			m=y
			break
		 r==0 r 0 m=y m y break x=y x y y=r y r return m m x x y y a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b if a>b:
	m=cgd(a,b)
elif a<b:
	m=cgd(b,a)
else:
	m=a a>b a b m=cgd(a,b) m cgd(a,b) cgd a b elif a<b:
	m=cgd(b,a) a<b a b m=cgd(b,a) m cgd(b,a) cgd b a m=a m a print(m) print m m=cgd(b,a) cgd(b,a) m def cgd(x,y):
	while(True):
		r=x%y
		if r==0:
			m=y
			break
		x=y
		y=r
	
	return m def cgd(x,y):
	while(True):
		r=x%y
		if r==0:
			m=y
			break
		x=y
		y=r
	
	return m cgd m=a a m b=map(int,input().split()) map(int,input().split()) b m=cgd(a,b) cgd(a,b) m a,b=map(int,input().split()) map(int,input().split()) a
def cgd(x,y):
	while(True):
		r=x%y
		if r==0:
			m=y
			break
		x=y
		y=r
	
	return m

a,b=map(int,input().split())
if a>b:
	m=cgd(a,b)
elif a<b:
	m=cgd(b,a)
else:
	m=a
print(m)
	
