#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int min1 = 1000000;
  for (int i = min(a, b); i <= max(a, b); i++) {
    int temp = i - min(a, b);
    int temp2 = (temp * (temp + 1)) / 2;
    temp = max(a, b) - i;
    int temp1 = (temp * (temp + 1)) / 2;
    if (temp1 + temp2 < min1) min1 = temp1 + temp2;
  }
  cout << min1 << endl;
  return 0;
}
