#include using namespace std; #define int long long #define ll long long #define pb push_back #define mp make_pair #define f(i,a,n) for(int i=a ; i<(int)n ; i++) #define rf(i,n,a) for(int i=n ; i>=a ; i--) #define F first #define S second #define all(c) (c).begin(),(c).end() #define sz(v) (int)(v).size() #define fast ios:: sync_with_stdio(false),cin.tie(nullptr); typedef long double ld; typedef vector vi; typedef pair pii; typedef pair ppi; typedef vector vpi; const int inf = 1e9; const int inf64 = 1e18; const int MOD = inf + 7; int32_t main(){ fast; int A,B; cin >> A >> B; int mx = max(A , B); int mn = min(A , B); int ans = 0; ans += 2*(mn - 1); ans += min(2LL ,max(0LL , mx - (mn - 1))); cout << ans << "\n"; }