import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
long m = sc.nextLong();
long x = m > n ? n : m; // 最小公倍数
while (m%x != 0 || n%x != 0) {
x--;
}
long y = m * n / x;
System.out.println(x + y);
}
}