A,B=map(int,input().split()) S,T=A+B,A*B res=1 S_dic={};T_dic={} for i in range(2,S//2+1): while S/i == S//i: if i not in S_dic.keys():S_dic[i]=1 else: S_dic[i]+=1 S=S//i for i in range(2,T//2+1): while T/i == T//i: if i not in T_dic.keys():T_dic[i]=1 else: T_dic[i]+=1 T=T//i for k in S_dic.keys(): if k in T_dic.keys(): res*=k**min(S_dic[k],T_dic[k]) print(res)