#include <bits/stdc++.h>
using namespace std;
int a, b, ans = 2147483647;
int main() {
  int i, tmp, len;
  cin >> a >> b;
  if (b < a) swap(a, b);
  for (i = a; i <= b; i++) {
    len = i - a;
    tmp = len * (len + 1) / 2;
    len = b - i;
    tmp += len * (len + 1) / 2;
    ans = min(ans, tmp);
  }
  cout << ans;
  return 0;
}
