#include "iostream"
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int x,y;
    cin >> x >> y;
    if(x != 1 && y != 1) cout << x*2 + ((y-2)*2)+((x-2)*(y-2))/2;
    else cout << (x+y) - 1;
}