#include<bits/stdc++.h>
#define ll long long
#define MAXN 200007
using namespace std;
void solve(ll a,ll b)
{
    cout<<2*(a+b-2)+(a-2)*(b-2)/2<<endl;
    return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int n,t=1;
    while(t--)
    {
        ll a,b;
        cin>>a>>b;
        solve(a,b);
    }
    return 0;
}