#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b;
  while (cin >> a >> b) {
    long long int minn;
    for (int i = 1; i <= 1000; i++) {
      long long int x = abs(a - i);
      long long int y = abs(b - i);
      long long int xx = (x * (x + 1)) / 2;
      long long int yy = (y * (y + 1)) / 2;
      if (i == 1) {
        minn = xx + yy;
      } else {
        minn = min(minn, xx + yy);
      }
    }
    cout << minn << endl;
  }
  return 0;
}
