#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int maxx = max(a, b);
  int minn = min(a, b);
  int tmp = a + b;
  long long res = 0;
  if (tmp & 1) {
    tmp /= 2;
    int j = tmp - minn;
    for (int i = 1; i <= j; i++) {
      res += i;
    }
    res *= 2;
    res += j + 1;
  } else {
    tmp /= 2;
    int j = tmp - minn;
    for (int i = 1; i <= j; i++) {
      res += i;
    }
    res *= 2;
  }
  cout << res << endl;
}
