#include <bits/stdc++.h>
using namespace std;

#define ll long long

const int N = 1e6 + 1;

ll n, m;
ll dp[N][N];


void solve() {
	cin >> n >> m;
	
	if(n > m) swap(n, m);
	
	dp[1][1] = 1;
	for(int i = 2; i <= m; i++){
		dp[1][i] = i + 1 + dp[1][i - 1];
	}
	
	for(int i = 2; i <= n; i++){
		for(int j = i; j <= m; j++){
			if (i == j) {
				dp[i][j] = i * j + dp[1][i] + dp[j - 1][i];
			}
			else 
				dp[i][j] = i * j + dp[1][i] + dp[i][j - 1];
		}
	}
	
	cout << dp[n][m];
}

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

	int T = 1;
//	cin >> T;
	while (T--) {
		solve();
	}
	return 0;
}

