#include<iostream>
using namespace std;

int main(){
	long long N, M;
	cin >> N >> M;
	long long resenje = N*M - (N-2)*(M-2) + (N-2)*(M-2)/2;
    if(N == 1 || M == 1) resenje = N * M;
	cout << resenje;
	return 0;
}