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