#include <bits/stdc++.h>

using namespace std;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<vector<int>>;
using ll = long long;
using uii = unordered_map<int, int>;
using ui = unordered_set<int>;


#define MOD 1000000007
#define INF 1e9
#define FOR(a, b, c) for (int a = b; a < c; ++a)
#define FORF(a, b, c) for (int a = b; a <= c; ++a)
#define FORB(a, b, c) for (int a = b; a >= c; --a)
#define sc second
#define fr first



void solve() {
    int n, m;
    cin >> n >> m;
    ll answer = 0;
    int mn = -1;
    while (n > 1 || m > 1) {
        mn = min(n, m);
        answer += n * m;
        answer += ((mn + 1) * mn) / 2 + (mn - 1);
        if (n > m) n--;
        else m--;
        }
    
    cout << answer + 1  << "\n";
}


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
