//最小公倍数溢出了 需要记笔记
#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;//一定要这个啊 啊啊
int gcd(int a,int b)
{
return !b?a:gcd(b,a%b);
}
int main()
{
LL n,m;
scanf("%lld%lld",&n,&m);
int d=gcd(n,m);
LL beishu=n/d*m;
printf("%lld\n",d+beishu);
return 0;
}