#include<iostream>
using namespace std;
int main() {
	unsigned long long a , b;
	cin >> a >> b;
	if ( b < a ) {
		unsigned long long sw = a;
		a = b;
		b = sw;
	}//b > a
	if ( b >= 2 * a ) {
		cout << 2 * a << endl;
		return 0;
	}
	if ( b % 2 == 1 ) {
		if ( b / 2 == a - 1 ) {
			cout << b - 1;
			return 0;
		}
		cout << b + 1 << endl;
		return 0;
	}
	if ( b % 2 == 0 ) {
		cout << b << endl;
		return 0;
	}
	
}
