A,B=map(int,input().split()) M=max(A*B,A+B) m=min(A*B,A+B) while(m>0): temp=m m=M%m M=temp print(M)