#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <string>

#define ll long long
#define ld long double 

using namespace std;

int main() {
	int n, m; cin >> n >> m;
	vector <ll> dp1(n + 1), dp2(m + 1);
	dp1[1] = 1;
	for (int i = 2; i <= n; ++i) {
		dp1[i] = i + 1 + dp1[i - 1];
	}
	dp2[1] = dp1[n];
		for (int j = 2; j <= m; ++j) {
			dp2[j] = dp2[j - 1] + dp1[n] + n * j;
		}
		cout << dp2[m];
}