#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    long long m;
    long long n;
    cin>>m>>n;
    long long ukbroj = 2*(m+n)-4+(m-2)*(n-2)/2;
    cout<< ukbroj;
    return 0;
}