def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n
print(gcd(*map(int, input().split()))) def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n gcd r = m % n r m % n m n return gcd(n, r) if r else n gcd(n, r) if r else n r gcd(n, r) gcd n r n m m n n print(gcd(*map(int, input().split()))) print gcd(*map(int, input().split())) gcd *map(int, input().split()) map(int, input().split()) map int input().split() ().split () input split def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n gcd
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n
print(gcd(*map(int, input().split())))