#include<iostream> using namespace std; long long a,b,c =1,g; int main() { cin>>a>>b; while(a%b!=0){ int d = a; a = b; b = d%b; } cout<<b; return 0; }