/*Lazy propagation 21
 *
 *
 * Imansoska228
 * Imancrush
 * Imantopchik
 * .*n*.
 * Author: Imansoska
**/
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define FF first
#define SS second
#define pb push_back
#define bp pop_back()
#define pf push_front
#define int long long
#define Imansoska ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define endl cout << "\n"
#define len(x) x.size()
//#define input cin 
//#define print cout
 
const int N = 1e5 + 13 ;
const int maxn= 1e6+100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;

int n , m;

signed main (/*Imansoska*/) {
	Imansoska
	// freopen("bfs.in","r",stdin);
	// freopen("bfs.out","w",stdout);
	cin >> n >> m;
	if ( n==1 || m==1 ) {
		cout << max(n,m)*(max(n,m)+1)/2+max(n,m)-1;
	}
	else {
		int ans=0;
		int a=max(n,m);
		int b=min(n,m);
		for ( int i=b; i>=2; i-- ) {
			ans+=i*a;
		}
		ans+= (a*(a+1)/2+a-1)*b;
		cout << ans;
	}
}