n=input().split()
x=int(n[0])
y=int(n[1])
if 1<=x<1000000000 and 1<=y<=1000000000:
	if x>y:
		while y!=0:
			t=y
			y=x%t
			x=t
		print(x)
	else:
		while x!=0:
			t=x
			x=y%t
			y=t
		print(y) n=input().split() n input().split() ().split () input split x=int(n[0]) x int(n[0]) int n[0] n 0 y=int(n[1]) y int(n[1]) int n[1] n 1 if 1<=x<1000000000 and 1<=y<=1000000000:
	if x>y:
		while y!=0:
			t=y
			y=x%t
			x=t
		print(x)
	else:
		while x!=0:
			t=x
			x=y%t
			y=t
		print(y) 1<=x<1000000000 and 1<=y<=1000000000 1<=x<1000000000 1<=x 1 x 1000000000 1<=y<=1000000000 1<=y 1 y 1000000000 if x>y:
		while y!=0:
			t=y
			y=x%t
			x=t
		print(x)
	else:
		while x!=0:
			t=x
			x=y%t
			y=t
		print(y) x>y x y while y!=0:
			t=y
			y=x%t
			x=t
		 y!=0 y 0 t=y t y y=x%t y x%t x t x=t x t print(x) print x while x!=0:
			t=x
			x=y%t
			y=t
		 x!=0 x 0 t=x t x x=y%t x y%t y t y=t y t print(y) print y t=y y t t=x x t x=int(n[0]) int(n[0]) x n=input().split() input().split() n y=t t y x=t t x x=y%t y%t x y=x%t x%t y y=int(n[1]) int(n[1]) y
n=input().split()
x=int(n[0])
y=int(n[1])
if 1<=x<1000000000 and 1<=y<=1000000000:
	if x>y:
		while y!=0:
			t=y
			y=x%t
			x=t
		print(x)
	else:
		while x!=0:
			t=x
			x=y%t
			y=t
		print(y)
