import sys
import math

(a, b) = tuple([int(s) for s in input().split()])

if a==b:
    print(a)
    sys.exit(0)

min = a if a < b else b
divisor = 1

i = 2
while i < math.sqrt(min):
    if a % i == 0 and b % i == 0:
        a = a / i
        b = b / i
        divisor = divisor * i
    else:
        i = i + 1

print(divisor) import sys sys import math math int(s) for s in input().split() for s in input().split() s input().split() ().split () input split for s in input().split() int(s) int s (a, b) = tuple([int(s) for s in input().split()]) (a, b) a b tuple([int(s) for s in input().split()]) tuple [int(s) for s in input().split()] if a==b:
    print(a)
    sys.exit(0) a==b a b print(a) print a sys.exit(0) sys.exit sys exit 0 min = a if a < b else b min a if a < b else b a < b a b a b divisor = 1 divisor 1 i = 2 i 2 while i < math.sqrt(min):
    if a % i == 0 and b % i == 0:
        a = a / i
        b = b / i
        divisor = divisor * i
    else:
        i = i + 1 i < math.sqrt(min) i math.sqrt(min) math.sqrt math sqrt min if a % i == 0 and b % i == 0:
        a = a / i
        b = b / i
        divisor = divisor * i
    else:
        i = i + 1 a % i == 0 and b % i == 0 a % i == 0 a % i a i 0 b % i == 0 b % i b i 0 a = a / i a a / i a i b = b / i b b / i b i divisor = divisor * i divisor divisor * i divisor i i = i + 1 i i + 1 i 1 print(divisor) print divisor b = b / i b / i b divisor = 1 1 divisor i = 2 2 i min = a if a < b else b a if a < b else b min divisor = divisor * i divisor * i divisor i = i + 1 i + 1 i a = a / i a / i a
import sys
import math

(a, b) = tuple([int(s) for s in input().split()])

if a==b:
    print(a)
    sys.exit(0)

min = a if a < b else b
divisor = 1

i = 2
while i < math.sqrt(min):
    if a % i == 0 and b % i == 0:
        a = a / i
        b = b / i
        divisor = divisor * i
    else:
        i = i + 1

print(divisor)