using System;
public class Program {
    public static void Main() {
        string[] s = Console.ReadLine().Split(" ");
        Console.WriteLine(GCD(long.Parse(s[0]), long.Parse(s[1])) + FindLCM(long.Parse(s[0]), long.Parse(s[1])));

    }
    
    public static long GCD(long a,long b)
    {
        if(b == 0)
        {
            return a;
        }
        long temp = b;
        b = a % b;
        a = temp;
        return GCD(a, b);
    }

    public static long FindLCM(long a,long b)
    {
        return Math.Abs(a*b)/GCD(a,b);
    }
}