#include<stdio.h>
int MaxCommonFactor( int a, int b)
{
int c;
if(a<=0||b<=0)
return -1;
while(b!=0)
{
c=a%b;
a=b;
b=c;
}
return a;
}
int main(void)
{ int x,y,z;
/*********Begin*********/
scanf("%d,%d",&x,&y);
z = MaxCommonFactor(x,y);
printf("%d\n",z);
/*********End**********/
return 0;
}