#include <stdio.h> long gcd(int n, int m){ while(n % m){ int tmp = n % m; n = m; m = tmp; } return m; } int main() { long n, m; while (scanf("%ld %ld", &n, &m) != EOF) { printf("%ld", gcd(n, m) + n * m / gcd(n, m)); } return 0; }