#include <bits/stdc++.h>
using namespace std;
using ll = long long;
mt19937_64 rnd(time(0));
#define push_back pb
#define make_pair mp
#define F first
#define S second
#define all(x) x.begin(), x.end()

const ll N = 2e5 + 5;
const ll INF = 1e15;

vector<ll> dx = {0, 1, 0, -1};
vector<ll> dy = {1, 0, -1, 0};

vector<ll> diagx = {1, 1, -1, -1};
vector<ll> diagy = {1, -1, -1, 1};

vector<string> a;
const ll n = 10, m = 10;

vector<vector<bool>> used(n, vector<bool> (n));

ll mx_x, mx_y, mn_x, mn_y, area;

void dfs(ll x, ll y) {
    mx_x = max(mx_x, x);
    mn_x = min(mn_x, x);
    mx_y = max(mx_y, y);
    mn_y = min(mn_y, y);
    area++;
    used[x][y] = true;

    for (int i = 0; i < 4; i++) {
        ll nx = x + dx[i], ny = y + dy[i];
        if (0 <= nx && nx < n && 0 <= ny && ny < m && !used[nx][ny] && a[nx][ny] == '#') {
            dfs(nx, ny);
        }
    }
}

ll cnt(ll n) {
    return (n * (n + 1)) / 2 + n - 1;
}

void solve() {
    ll h, w; cin >> h >> w;
    ll s = h * w;
    ll ans = 0;
    if (h > 1 && w > 1) ans = s;
    while (h > 1 && w > 1) {
        if (h > w) swap(h, w);
        ans += cnt(h);
        if (w > 2) ans += s - h;
        s -= h;
        w--;
    }
    //cout << ans << " " << h << " " << w  << endl;
    if (h > 1) ans += cnt(h);
    if (w > 1) ans += cnt(w);
    cout << ans;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);

    solve();

    return 0;
}