a,b=map(int,input().split())
A=a+b
B=a*b
while A%B!=0:
    A,B=B,A%B
print(B)