#include using namespace std; int gcd(int a, int b) { if (a == 1 || b == 1) { return min(a, b); } else { return gcd(min(a, b), max(a, b) % min(a, b)); } } int main() { int A, B; int n; cin >> A >> B; n = gcd(A, B); A = A / n; B = B / n; if (min(A, B) == max(A, B) - 1) { cout << (min(A, B) + 2) * n <