#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
using namespace std;
typedef long long LL;
typedef long double LD;
typedef complex<LD> CMP;

class TheBrickTowerEasyDivOne { public:
	int find(int redCount, int redHeight, int blueCount, int blueHeight)
	{
		if(redHeight != blueHeight)
		{
			int ans = 0;
			ans += min(redCount, blueCount);
			ans += min(redCount-1, blueCount) + 1;
			ans += min(redCount, blueCount-1) + 1;
			return ans;
		}
		return min(redCount,blueCount)*2 + (redCount != blueCount);
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const int& Expected, const int& Received) {
 bool ok = (Expected == Received);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, TheBrickTowerEasyDivOne().find(redCount, redHeight, blueCount, blueHeight));}
int main(){

CASE(0)
	int redCount = 1; 
	int redHeight = 2; 
	int blueCount = 3; 
	int blueHeight = 4; 
	int _ = 4; 
END
CASE(1)
	int redCount = 4; 
	int redHeight = 4; 
	int blueCount = 4; 
	int blueHeight = 7; 
	int _ = 12; 
END
CASE(2)
	int redCount = 7; 
	int redHeight = 7; 
	int blueCount = 4; 
	int blueHeight = 4; 
	int _ = 13; 
END
CASE(3)
	int redCount = 47; 
	int redHeight = 47; 
	int blueCount = 47; 
	int blueHeight = 47; 
	int _ = 94; 
END
/*
CASE(4)
	int redCount = ; 
	int redHeight = ; 
	int blueCount = ; 
	int blueHeight = ; 
	int _ = ; 
END
CASE(5)
	int redCount = ; 
	int redHeight = ; 
	int blueCount = ; 
	int blueHeight = ; 
	int _ = ; 
END
*/
}
// END CUT HERE
