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

