a,b;main(t){for(scanf("%d%d",&a,&b);t;a=b,b=t)t=a%b;a=!printf("%d",a);}