#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;
using vi = vector<ll>;
using vvi = vector<vi>;
using pi = pair<ll, ll>;
using vpi = vector<pi>;
const ll inf = 998244353;
#define all(a) a.begin(), a.end()

const int N = 1e6 + 5;
ll dp1[N], dp2[N];


int main() {
    long long h, w;
    cin >> h >> w;
    if(h < w)swap(h, w);
    dp1[1] = 1;
    for(int i = 2; i <= w; ++i)dp1[i] = 1 + w + dp1[i - 1];
    dp2[1] = dp1[w];
    for(int i = 2; i <= h; ++i)dp2[i] = i * w + dp1[w] + dp2[i - 1];
    cout << dp2[h] << '\n';
}

