def gcd( x, y ):
	if 0 == y:
		return x
	else:
		return gcd( y, x%y )
		
a, b = [ int( val ) for val in input( ).split( " " ) ]
if a < b:
	a, b = b, a
print( gcd( a, b ) ) def gcd( x, y ):
	if 0 == y:
		return x
	else:
		return gcd( y, x%y )
		 gcd if 0 == y:
		return x
	else:
		return gcd( y, x%y )
		 0 == y 0 y return x x return gcd( y, x%y ) gcd( y, x%y ) gcd y x%y x y x x y y int( val ) for val in input( ).split( " " ) for val in input( ).split( " " ) val input( ).split( " " ) ( ).split ( ) input split " " for val in input( ).split( " " ) int( val ) int val a, b = [ int( val ) for val in input( ).split( " " ) ] a [ int( val ) for val in input( ).split( " " ) ] b if a < b:
	a, b = b, a a < b a b a, b = b, a a b b a print( gcd( a, b ) ) print gcd( a, b ) gcd a b def gcd( x, y ):
	if 0 == y:
		return x
	else:
		return gcd( y, x%y )
		 def gcd( x, y ):
	if 0 == y:
		return x
	else:
		return gcd( y, x%y )
		 gcd b = [ int( val ) for val in input( ).split( " " ) ] [ int( val ) for val in input( ).split( " " ) ] b b = b, a a b a, b = [ int( val ) for val in input( ).split( " " ) ] [ int( val ) for val in input( ).split( " " ) ] a a, b = b, a b a
def gcd( x, y ):
	if 0 == y:
		return x
	else:
		return gcd( y, x%y )
		
a, b = [ int( val ) for val in input( ).split( " " ) ]
if a < b:
	a, b = b, a
print( gcd( a, b ) )