#include int main(void){ long a,b,c; scanf("%ld%ld",&a,&b); while(a%b){ c=a%b; a=b; b=c; }printf("%ld",b); }