if __name__ == '__main__':
	a, b = input().split()
	a, b = int(a), int(b)
	if a < b:
		x = b
		y = a
	else:
		x = a
		y = b
	while True:
		x, y= y, x % y
		if y == 0:
			print(x)
			break
		else:
			continue if __name__ == '__main__':
	a, b = input().split()
	a, b = int(a), int(b)
	if a < b:
		x = b
		y = a
	else:
		x = a
		y = b
	while True:
		x, y= y, x % y
		if y == 0:
			print(x)
			break
		else:
			continue __name__ == '__main__' __name__ '__main__' a, b = input().split() a input().split() ().split () input split b a, b = int(a), int(b) a int(a) int a b int(b) int b if a < b:
		x = b
		y = a
	else:
		x = a
		y = b
	 a < b a b x = b x b y = a y a x = a x a y = b y b while True:
		x, y= y, x % y
		if y == 0:
			print(x)
			break
		else:
			continue True x, y= y, x % y x y y x % y x y if y == 0:
			print(x)
			break
		else:
			continue y == 0 y 0 print(x) print x break continue a, b = input().split() input().split() a x = b b x b = int(a), int(b) int(b) b y = b b y x = a a x x, y= y, x % y y x y= y, x % y x % y y b = input().split() input().split() b y = a a y a, b = int(a), int(b) int(a) a
if __name__ == '__main__':
	a, b = input().split()
	a, b = int(a), int(b)
	if a < b:
		x = b
		y = a
	else:
		x = a
		y = b
	while True:
		x, y= y, x % y
		if y == 0:
			print(x)
			break
		else:
			continue
