#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
long long int f(long long int x) { return (x * (x + 1)) / 2; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin.tie(NULL);
  long long int n, m, i, j, k, ans = 100000000000, a, b;
  cin >> a >> b;
  if (a > b) swap(a, b);
  for (i = a; i <= b; i++) {
    k = f(i - a) + f(b - i);
    ans = min(ans, k);
  }
  cout << ans << endl;
  return 0;
}
