#include <bits/stdc++.h>

using namespace std;

int main() {
    long long int n, m;
    cin >> n >> m;
    long long int all_tiles = n * m;
    long long int inner_strazari = ((n - 2) * (m - 2)) / 2;
    long long int free_tiles = (n - 2) * (m - 2) - inner_strazari;
    cout << all_tiles - free_tiles;
    return 0;
}