def gcd(a,b): 
    if b == 1:
        return 1
    else:
        return (gcd(b,a%b) if b != 0 else a)
A = list(map(int,input().split()))
print(gcd(A[0],A[1])) def gcd(a,b): 
    if b == 1:
        return 1
    else:
        return (gcd(b,a%b) if b != 0 else a) gcd if b == 1:
        return 1
    else:
        return (gcd(b,a%b) if b != 0 else a) b == 1 b 1 return 1 1 return (gcd(b,a%b) if b != 0 else a) gcd(b,a%b) if b != 0 else a b != 0 b 0 gcd(b,a%b) gcd b a%b a b a a a b b A = list(map(int,input().split())) A list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split print(gcd(A[0],A[1])) print gcd(A[0],A[1]) gcd A[0] A 0 A[1] A 1 def gcd(a,b): 
    if b == 1:
        return 1
    else:
        return (gcd(b,a%b) if b != 0 else a) def gcd(a,b): 
    if b == 1:
        return 1
    else:
        return (gcd(b,a%b) if b != 0 else a) gcd A = list(map(int,input().split())) list(map(int,input().split())) A
def gcd(a,b): 
    if b == 1:
        return 1
    else:
        return (gcd(b,a%b) if b != 0 else a)
A = list(map(int,input().split()))
print(gcd(A[0],A[1]))