#include <iostream>

using namespace std;

int main(void){

    unsigned long long int n, m;
    cin >> n >> m;

    unsigned long long int osnova = (m + n - 2) * 2;

    unsigned long long int brojRedara = osnova + ((m-2) * (n-2) / 2);

    cout << brojRedara << endl;


    return 0;
}