#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_aA,gcd_aB,eq_gcd,calc; a=A+B; gcd_aA=gcd(a,A); gcd_aB=gcd(a,B); eq_gcd=gcd(gcd_aA,gcd_aB); calc = a; while(1){ if(calc%eq_gcd!=0||eq_gcd==1) break; calc/=eq_gcd; gcd_aA=gcd(calc,A); gcd_aB=gcd(calc,B); if(gcd(eq_gcd*gcd(gcd_aA,gcd_aB),a)!=eq_gcd*gcd(gcd_aA,gcd_aB)) break; eq_gcd*=gcd(gcd_aA,gcd_aB); } printf("%llu\n",eq_gcd); return 0; }