# https://open.kattis.com/problems/gcd
# 1s
# 1.7 Easy

# 70 chars Not short enought for Top 10 (13..36 chars)
import math
a,b=[int(i) for i in input().split()]
print(math.gcd(a,b))
