#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int N, M; //N - Broj redova; M - Broj sedista
    cin >> N >> M;
    int redari;
    if(N % 2 == 0 && M % 2 == 0){
        redari = 2*N + ((N/2)+1)*(N-2);
    }else{
        redari = 2*N + ((N-2)*(M-2))/2 + 2*(M-2);
    }
    cout<< redari;

    return 0;
}