#include
int gcd(int m, int n)
{
int k;
while(m!=n)
{
if(m>n)
{
k=m-n;
m=n;
n=k;
}
else
{
k=n-m;
m=n;
n=k;
}
}
return m;
}
int main()
{
int m, n;
scanf("%d, %d",&m, &n);
printf("%d\n",gcd(m,n));
return 0;
}
#include
int gcd(int m, int n)
{while(n!=m)
{
while(n>m)n-=m;
while(m>n)m-=n;
}
return n;
}
int main()
{
int m, n;
scanf("%d%d",&m, &n);
printf("%d\n",gcd(m,n));
return 0;
}