import sys import math def gcd(x,y): if x < y: return gcd(y,x) if y==0: return x return gcd(y,x%y) A,B=map(int,raw_input().strip().split(" ")) C=A+B D=A*B print gcd(C,D)