#include<iostream>
using namespace std;

long long GCD(long long a,long long b){
    if(b==0)return a;
    else return GCD(b,a%b);
}

int main(){
    long long a,b;
    while(scanf("%lld %lld",&a,&b)!=EOF){
        printf("%lld\n",GCD(a,b)+a/GCD(a,b)*b);
    }
    return 0;
}