#include unsigned long long int gcd(unsigned long long int a,unsigned long long int b){ unsigned long long int temp,r; while(1){ if(a>b){ temp=a; a=b; b=temp; } else{ r=b%a; if(r==0) break; b=r; } } return a; } int main(){ unsigned long long int A,B; scanf("%llu %llu",&A,&B); unsigned long long int a,gcd_ab,gcd_aa,eq_gcd,calc; a=A+B; gcd_aa=gcd(a,A); gcd_ab=gcd(a,B); eq_gcd=gcd(gcd_ab,gcd_aa); calc = gcd_ab*gcd_aa/eq_gcd; unsigned long long int i=2; while(1){ if(calc>=a){ calc /=i-1; break; }else if(i>eq_gcd) break; if(gcd(i,eq_gcd)==i && gcd(i,a)==i) calc *= i; i++; } printf("%llu\n",calc); return 0; }