#include <stdio.h> #include <math.h> int main() { long long a, b, n, m, k; scanf("%lld %lld", &a, &b); long long max = 0; n = a; m = b; while ((n % m) != 0) { //辗转相除法,直至余数为0,被除数即为结果 k = n % m; n = m; m = k; } max = k; long long min = (a * b) / max; long long x = min + max; printf("%lld", x); return 0; }