from math import gcd def main(): A, B = map(int, input().split()) print(gcd(A, B)) main()