#include <bits/stdc++.h>
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const long long LINF = 1e18;
using namespace std;
long long n, cnt, ans, a, b, c, d, tmp, tmpp, m, h, w, x, y, sum, pos, k;
long double doua;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
bool fl;
struct edge {
  int to, cost;
};
long long dat[ohara];
int main(void) {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  cin >> a >> b;
  cnt = 1;
  dat[cnt] = cnt;
  for (int i = (2); i < (1500); i++) {
    cnt += i;
    dat[i] = cnt;
  }
  ans = LINF;
  for (int(i) = 0; (i) < (int)(1500); (i)++) {
    cnt = 0;
    long long kyori = abs(a - i);
    cnt = dat[kyori];
    kyori = abs(b - i);
    cnt += dat[kyori];
    ans = min(ans, cnt);
  }
  cout << (ans) << endl;
  return 0;
}
