#include <bits/stdc++.h>

using namespace std;

using ll = unsigned long long;
using ld = long double;

/#define int unsigned long long

string to_str(int a, int b) {
    return to_string(a) + " " + to_string(b);
}

map<string, int> mem;

int calc(int a, int b) {
    if (a < b)
        swap(a, b);
    if (mem.find(to_str(a, b)) != mem.end()) {
        return mem[to_str(a, b)];
    }


    if (a == 1) {
        return 1;
    }
    int res = a * b + calc(a - 1, b) + calc(1, b);
    mem[to_str(a, b)] = res;
    return res;
}

void solve() {
    int a, b;
    cin >> a >> b;
    cout << calc(a, b) << endl;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    //freopen("input.in", "r", stdin);
    while (t--) {
        solve();
    }
    return 0;
}
