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

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()

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

void solve() {
    ll n, m; cin >> n >> m;
    ll x1 = n * (m * (m + 1) / 2 + m - 1);
    if (n != 1) x1 += n * m;
    ll x2 = m * (n * (n + 1) / 2 + n - 1);
    if (m != 1) x2 += n * m;
    cout << max(x1, x2);
}

int main() {
    int T = 1;
    //    cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}
