import sys
a1,b1 = list(map(int,input().split()))

def gcd(a,b):
    if(b == 0):
        return a
    else:
        c = b
        b = a%b
        a = c

        return(gcd(a,b))

print(gcd(a1,b1)) import sys sys a1,b1 = list(map(int,input().split())) a1 list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split b1 def gcd(a,b):
    if(b == 0):
        return a
    else:
        c = b
        b = a%b
        a = c

        return(gcd(a,b)) gcd if(b == 0):
        return a
    else:
        c = b
        b = a%b
        a = c

        return(gcd(a,b)) b == 0 b 0 return a a c = b c b b = a%b b a%b a b a = c a c return(gcd(a,b)) gcd(a,b) gcd a b a a b b print(gcd(a1,b1)) print gcd(a1,b1) gcd a1 b1 a1,b1 = list(map(int,input().split())) list(map(int,input().split())) a1 def gcd(a,b):
    if(b == 0):
        return a
    else:
        c = b
        b = a%b
        a = c

        return(gcd(a,b)) def gcd(a,b):
    if(b == 0):
        return a
    else:
        c = b
        b = a%b
        a = c

        return(gcd(a,b)) gcd b1 = list(map(int,input().split())) list(map(int,input().split())) b1
import sys
a1,b1 = list(map(int,input().split()))

def gcd(a,b):
    if(b == 0):
        return a
    else:
        c = b
        b = a%b
        a = c

        return(gcd(a,b))

print(gcd(a1,b1))