#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <math.h>
#include <set>

using namespace std;
typedef long long ll;
#define cy cout << "YES"<< endl;
#define cn cout << "NO"<< endl;
#define pf push_front
#define pb push_back
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vll vector<ll>


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(nullptr);
    
    ll n,m;cin >> n >> m;
    if(n<=2 || m<=2)
    {
        cout << n* m << endl;
    }
    else
    {
        ll spoljni = (2*n) + (2*(m-2));
        ll unutrasnji = ((n-2) * (m-2))/2;
        cout << spoljni + unutrasnji << endl;
    }

}