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