#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using ld = long double;
using ull = unsigned long long;
#define pb  push_back
#define pf  push_front
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define x first
#define y second
const ll mod = 1e9 + 7;
const int N = 1e6 + 1;
const ll INF = 1e18;


int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	vll dp(N);
	dp[1] = 1;
	for(int i = 2; i < N; i++){
		dp[i] = dp[i-1] + i + 1;
	}
	ll x, y; cin >> x >> y;
	if(x < y)swap(x, y);
	ll ans = 0;
	while(y > 1){
		ans += dp[x] + x*y;
		y--;
	}
	ans += dp[x];
	cout << ans << '\n';
	return 0;
}