#include <iostream>
using namespace std;

int main()
{
    unsigned long long int n, m;
    unsigned long long int ans;
    cin >> n >> m;
    ans = (2 * n + 2 * (m - 2)) + (n - 2) * (m - 2) / 2;
    cout << ans;
}