#include <algorithm>
#include <iostream>
#include <set>
#include <vector>

using namespace std;
const long long maxn = 1000001;
int main() {
    long long h,w, ans = 0; cin >> h >> w;
    vector <long long> starts(maxn), firststep(maxn);
    starts[1] = 1;
    for (int i=2; i<=maxn-1; i++) {
        starts[i] = starts[i-1] + i + 1;
    }
    firststep[1] = 3;
    for (int i=2; i<=maxn-1; i++) {
        firststep[i] = firststep[i-1] + i + 3;
    }
    ans = starts[h];
    for (int i=0; i<w - 1; i++) {
        ans += (firststep[h] + i * h);
    }
    cout << ans;
    return 0;
}