#include <bits/stdc++.h>
using namespace std;
int a, b, r = 1e9;
int gaus(int n) { return (n * (n + 1)) / 2; }
int main() {
  cin.sync_with_stdio(false);
  cin >> a >> b;
  if (a > b) swap(a, b);
  for (int i = a; i <= b; i++) r = min(r, gaus(i - a) + gaus(b - i));
  cout << r;
}
