#include <iostream>
using namespace std;
long long int rez;
long long int N,M;
int main()
{
    cin >> N >> M;
    if( N < 1 || M < 1) return 0;
    rez = (2*N + 2*(M-2)) + ((N-2)*(M-2)/2);
    cout << rez;
    return 0;
}