//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define ent "\n"
#define int long long
#define f first
#define s second

const int maxn = 1e6 + 100;
const int inf = (int)1e9 + 100;
const ll INF = (ll)1e18;
const int MOD = 1e9 + 7;
const int maxl = 20;
const ll P = 31;

int ans[maxn];

int f(int x){
    if(ans[x] != -1) return ans[x];
    if(x == 1) return ans[x] = 1;
    return ans[x] = x + f(1) + f(x - 1);
}

int f1(int a, int b){
    if(a == 1) return f(b);
    return f(b) + f1(a - 1, b) + a * b;
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    fill(ans, ans + maxn, -1);
    int a, b; cin >> a >> b;
    cout << max(f1(a, b), f1(b, a));
}
