#include #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; int main(){ int n,m; scanf("%d%d",&n,&m); printf("%d\n",gcd(n,m)); return 0; }