#include <stdio.h>
int main(int argc,char*argv[]) {
int mcd, i = 1,a,b;
mcd = 1;
scanf("%d",&a);
scanf("%d",&b);
if (a<b) {
mcd = a;
while (a % mcd !=0 || b % mcd !=0) {
i++;
mcd = a/i;
}
} else {
mcd = b;
while (a % mcd !=0 || b % mcd !=0) {
i++;
mcd = b/i;
}
}
printf("%d",mcd);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbihpbnQgYXJnYyxjaGFyKmFyZ3ZbXSkgewoJaW50IG1jZCwgaSA9IDEsYSxiOwoJbWNkID0gMTsKCXNjYW5mKCIlZCIsJmEpOwoJc2NhbmYoIiVkIiwmYik7CglpZiAoYTxiKSB7CgkJbWNkID0gYTsKCQl3aGlsZSAoYSAlIG1jZCAhPTAgfHwgYiAlIG1jZCAhPTApIHsKCQkJaSsrOwoJCQltY2QgPSBhL2k7CgkJfQoJfSBlbHNlIHsKCQltY2QgPSBiOwoJCXdoaWxlIChhICUgbWNkICE9MCB8fCBiICUgbWNkICE9MCkgewoJCQlpKys7CgkJCW1jZCA9IGIvaTsKCQl9CgoKCX0KCXByaW50ZigiJWQiLG1jZCk7CgoKCXJldHVybiAwOwp9