#include <iostream> using namespace std; int main(){ int a,b,y; cin>>a>>b; y=a%b; while(y!=0){ a=b; b=y; y=a%b; } cout<<b; }