#include<stdio.h>
main()
{
int a, b, c;
scanf("%d%d", &a, &b);
while(b!=0)
{
c=a%b;
a=b;
b=c;
}
printf("%d\n",a);
return 0;
}
#include<stdio.h>
main()
{
int a, b, c;
scanf("%d%d", &a, &b);
while(b!=0)
{
c=a%b;
a=b;
b=c;
}
printf("%d\n",a);
return 0;
}