#include<iostream>
using namespace std;
int main(){
int a,b,c=1,i=1;
cin>>a>>b;
while(a>i || b>i){
if(a%i==0&&b%i==0){
a=a/i;
b=b/i;
c=c*i;
}
i+=1;
cout<<c;