#include <iostream>

using namespace std;

long long n, m, a, b;

int main()
{
    cin >> n >> m;
    a=(n*m)-2*(n+m-2);
    if(n==m) b=2*(n+m-2)+(a/2);
    else if(a%2==0) b=2*(n+m-2)+(a/2)+1;
    else if(a%2!=0) b=2*(n+m-2)+(a/2);
    cout << b;
}