import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        long n = scanner.nextLong();
        long m = scanner.nextLong();
        
        long max = m > n ? m : n;
        long min = m < n ? m : n;
        long product = m * n;
        
        long gys = 0;
        long gbs = 0;
        //最大公约数
        for(long i = min; i >= 1; i--) {
            if(min % i == 0 && max % i == 0) {
                gys = i;
                break;
            }
        }
        
        //最小公倍数
//         for(long i = max; i <= product; i++) {
//             if(i % max == 0 && i % min == 0) {
//                 gbs = i;
//                 break;
//             }
//         } 求一下为什么这里不行啊
        gbs = product / gys;
        System.out.println(gys + gbs);
        
    }
}