#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <random>
#include <numeric>
#include <map>
#include <set>
#include <string>
#include <iomanip>

using namespace std;
using ll = long long;
using ld = long double;

#define deb(x) cerr << #x << ":\t" << x << '\n';
#define len(x) (ll) x.size()
#define ff first
#define ss second

const ll INF = 8e18;
const ll MOD = 1e9 + 7;

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

void solve() {
    ll n, m; cin >> n >> m;
    ll ans = 0;
    while (n != 1 || m != 1){
        if (n > m) swap(n, m);
        ans += f(n) + n * m;
        m--;
    }
    cout << ans + 1;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    int T = 1;
//    cin >> T;
//    cout << setprecision(9) << fixed;
    while (T--) {
        solve();
    }
    return 0;
}
