#include <iostream>
using namespace std;
int main() {
    cin.tie(NULL);
    ios::sync_with_stdio(false);
    long long n, m;
    cin >> n >> m;
    if (n == 1 or m == 1) cout << n * m;
    cout << 2 * (n + m - 2) + (n - 2) * (m - 2) / 2;
    return 0;
}