#include <bits/stdc++.h>
using namespace std;
long long res, a, b, p, p2, i, n;
long long s[3000];
int main() {
  cin >> a >> b;
  s[1] = 1;
  s[2] = 2;
  s[3] = 4;
  s[4] = 6;
  p = 3;
  n = a - b;
  if (n < 1) n = n * (-1);
  for (i = 5; i <= n; i++) {
    s[i] = s[i - 1] + p;
    p++;
  }
  cout << s[n];
  return 0;
}
