#include <iostream>

using namespace std;

int main()
{
    long long N,M,R;
    cin >> N >> M;
    long long a[N][M];
    R=(N*2+M*2)-4;
    if(N==M)
        R+=4;
    else if(N>M)
        R+=7;
    cout << R;
    return 0;
}