#include<iostream>

using namespace std;

int gcd(int x,int y) {//??????????????????????????????
	int r;
	if (x < y)swap(x, y);
	while (y > 0) {
		r = x%y;
		x = y;
		y = r;
	}
	return x;
}

int main() {
	int a, b, c;
	while (cin >> a >> b) {
		c = gcd(a, b);
		cout << a+b+1-c <<endl;
	}
	return 0;
}