#include <iostream>
#include <vector>
#define ll long long
using namespace std;

ll n, m;

int main(void) {

    ios_base::sync_with_stdio(0); cin.tie(0);

    cin >> n >> m;
    
    cout << ( 2 * ( n + m - 2) ) + ( ( ( n - 2 ) * ( m - 2 ) ) / 2 );

    return 0;
}