#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long long n,m;
    cin >> n >> m;
    int q = 2;
    int w = 2;
    if(m==1){
        q=1;
    }
    if(m==1){
        w = 0;
    }
    long long br = q*n + abs((m-2)*w);
    long long p = n-2;
    long double f = p/2.;
    long long l = m-2;
    long double k = (p-1)/2.;
    long long br1=0;
    long long br2=0;
    for(long long i = 2;i<=l;i+=2){
        br1++;
    }
    for(long long i = 1;i<=l;i+=2){
        br2++;
    }
    br=br+(br1*(ceil(f)))+(br2*(ceil(k)));
    cout << br;
    return 0;
}