#include <stdio.h> //辗转相除法 int main() { long long m, n; while (scanf("%lld %lld", &m, &n) != EOF) { // 注意 while 处理多个 case // 64 位输出请用 printf("%lld") to long long max,min; long long a = m; long long b = n; long long c = 0; while(c = a % b) { a = b; b = c; } max = b; min = m * n / max; printf("%lld\n",min + max); } return 0; }