A,B=list(map(int,input().split()))

def gcd(A, B):
	if B==0: return(A)
	else: return(gcd(B, A%B))

print(gcd(A,B)) A,B=list(map(int,input().split())) A list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split B def gcd(A, B):
	if B==0: return(A)
	else: return(gcd(B, A%B)) gcd if B==0: return(A)
	else: return(gcd(B, A%B)) B==0 B 0 A A B B print(gcd(A,B)) print gcd(A,B) gcd A B B=list(map(int,input().split())) list(map(int,input().split())) B A,B=list(map(int,input().split())) list(map(int,input().split())) A def gcd(A, B):
	if B==0: return(A)
	else: return(gcd(B, A%B)) def gcd(A, B):
	if B==0: return(A)
	else: return(gcd(B, A%B)) gcd
A,B=list(map(int,input().split()))

def gcd(A, B):
	if B==0: return(A)
	else: return(gcd(B, A%B))

print(gcd(A,B))