#include<stdio.h>
long Small(long p, long q)
{
long n = p > q ? p : q;
long m = 1;
while (m)
{
if ((m * n) % p == 0 && (m * n) % q == 0)
{
break;
}
m++;
}
return m * n;
}
long Big(long x, long y)
{
long z = 0;
while (x % y)
{
z = x % y;
x = y;
y = z;
}
return y;
}
int main()
{
long a = 0;
long b = 0;
long sum = 0;
scanf("%ld %ld", &a, &b);
long i = Big(a, b);
long j = (a*b)/i;
sum = i + j;
printf("%ld\n", sum);
return 0;
}