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

#define ll long long
#define int long long
#define pb push_back
#define all(x) x.begin(), x.end()

const int maxn = 1e3 + 5;
const int mod = 1e9 + 7;

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  
  int a, b;
  cin >> a >> b;
  if (a > b) swap(a, b);
  int ans = 0;
  double d = 5;
  double k = 4.5;
  double l = 1.0;
  for (int i = 2; i < a; i++) {
    d += k;
    k += 1.0;
  }
  cout << (int)((0.5 * a) * (b * b) + d * b - a);
}