def divide(a, b):
	if a < b:
		return divide(b, a)
	if b == 0:
		return a
	return divide(b, a%b)
	
nums=list(map(int,input().split()))

ans = divide(nums[0], nums[1])

print(ans) def divide(a, b):
	if a < b:
		return divide(b, a)
	if b == 0:
		return a
	return divide(b, a%b)
	 divide if a < b:
		return divide(b, a)
	 a < b a b return divide(b, a) divide(b, a) divide b a if b == 0:
		return a
	 b == 0 b 0 return a a return divide(b, a%b) divide(b, a%b) divide b a%b a b a a b b nums=list(map(int,input().split())) nums list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ans = divide(nums[0], nums[1]) ans divide(nums[0], nums[1]) divide nums[0] nums 0 nums[1] nums 1 print(ans) print ans nums=list(map(int,input().split())) list(map(int,input().split())) nums def divide(a, b):
	if a < b:
		return divide(b, a)
	if b == 0:
		return a
	return divide(b, a%b)
	 def divide(a, b):
	if a < b:
		return divide(b, a)
	if b == 0:
		return a
	return divide(b, a%b)
	 divide ans = divide(nums[0], nums[1]) divide(nums[0], nums[1]) ans
def divide(a, b):
	if a < b:
		return divide(b, a)
	if b == 0:
		return a
	return divide(b, a%b)
	
nums=list(map(int,input().split()))

ans = divide(nums[0], nums[1])

print(ans)
