/* algorytm Euklidesa */
#include<stdio.h>
int nwd(int a,int b);
int main()
{
int a,b;
scanf("%d",&a);
scanf("%d",&b);
printf("nwd(%d,%d)=%d",a,b,nwd(a,b));
return 0;
}
int nwd(int a,int b)
{
int temp;
while(b)
{
temp = b;
b = a%b;
a = temp;
}
return a;
}