A,B=map(int,input().split()) a=A*B b=A+B while b:a,b=b,a%b print(a)