/* Author : LOverzIT 
 Rating : 1169
 Goal : 1400 
*/ 

#include <bits/stdc++.h> 
  
#define ll long long 
#define vc vector 
#define fi first 
#define se second 
#define sz(x) (int)x.size() 
#define pb push_back 
#define sort(a) sort(a.begin(),a.end()) 
#define reverse(a) reverse(a.begin(),a.end()) 
#define all(x) x.begin(),x.end()

using namespace std; 

void solve() {
	ll n, m;
	cin >> n >> m;
	if ( m < n ) swap(m,n);
		ll ans = 0;
		for ( int i = 1; i < m; i++ ) {
			ans += i * n;
		}
		ans += n * m;
		ll x = n;
		ans += (x  + ( x - 1 ) * ( x ) / 2 + ( x - 1 )) * m;
		ans -= n;
		cout << ans;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
    solve();
}