#include <bits/stdc++.h>
#define endl '\n'
#define int ll
#define ve vector
#define pb push_back
#define all(x) x.begin() , x.end()
#define pii pair <int , int>
#define F first
#define S second

using namespace std;
typedef long long ll;
typedef long double ld;
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt" , "r" , stdin);
        freopen("output.txt" , "w" , stdout);
    #endif // LOCAL
    int n, m;
    cin >> n >> m;
    int ans = 0;
    while (min(n, m) >= 1) {
        ans += (n * m);
        int len = min(n, m);
        if (n > m) n--;
        else m--;
        ans += len;
        ans += (len * (len + 1)) / 2 - 1;
    }
    cout << ans - 1;
    return 0;

}
