#include <stdio.h>

int main() 
{
    long n,m,r,i;
    scanf("%ld %ld",&n,&m);i=n*m;
     do
    {
        r=n%m;
        n=m;
        m=r;
    }while(r);
    printf("%ld",i/n+n);
}