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