#include <iostream>`
using namespace std;`
int main(){`
int m,n;
cin>>m>>n;
for(int k=m*n;k>=m+n-1;k--){
int i=k;
while(i%m!=0&&i%n!=0){
i=i-m;
if(i<=0)
{break;}
}
if(i<=0){
cout<<k;
break;
}
}
return 0;
}