#include <bits/stdc++.h>

using namespace std;

#define ld double
#define ll long long

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, m;
    cin >> n >> m;
    if(n < m){
        swap(n, m);
    }
    vector<ll> dp(n + 1);
    dp[1] = 1;
    for(ll i = 2; i < dp.size(); ++i){
        dp[i] = dp[i - 1] + 1 + i;
    }
    // cout << m * dp[n] + (2 * m + n * m) * (n - 2) / 2;
    ll sum = 0;
    for (int i = 2; i <= m; ++i)
    {
        sum += i * n;
    }
    cout << sum + dp[n] * m;
}
//