#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 = 1e5;
const ll INF = 1e18;

ll get(ll x, ll y){
	//cout << x << " " << y << '\n';
	if(x == 1 && y == 1){
		return 1;
	}
	if((x > y || x == 1) && y != 1){
		return x*y + get(x, y-1) + get(x, 1); 
	}
	else{
		return x*y + get(x-1, y) + get(1, y);
	}
}

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	ll x, y; cin >> x >> y;
	cout << get(x, y) << '\n';
	return 0;
}