#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); printf("%llu\n",eq_gcd); return 0; }