import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from math import gcd a,b = map(int,read().split()) answer = gcd(a+b,a*b) print(answer)