#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    ll n, m; cin >> n >> m;
    if (n > m) swap(n, m);

    ll ans = m;
    if (n != 1)
        ans = max(1ll, 2 * (n + m) - 4);

    if (n % 2 == 0) {
        ll br = (n - 1) / 2;
        ans += (n + m - 2) * br - ((br * (br + 1) / 2) * 4);
    } else {
        ll br = max(0ll, (n - 3) / 2);
        ans += (n + m - 2) * br - ((br * (br + 1) / 2) * 4);
        if (n != 1) {
            ll br_sa = (n - 1) / 2;
            m -= br_sa * 2;
            ans += (m / 2);
        }
    }

    cout << ans << "\n";
}