#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("avx")
using namespace std;
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return __builtin_popcount(s);
}
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
const int MAXN = 5e5 + 100;
const int MOD = 1e9 + 7;
const long long MAXV = 1e6;
const double eps = 1e-12;
const long long INF = 1e16;
inline string toStr(long long x) {
  string tmp = "";
  do tmp = char(x % 10 + '0') + tmp;
  while (x /= 10);
  return tmp;
}
inline long long toInt(string s) {
  long long res = 0;
  for (auto x : s) res = res * 10 + x - '0';
  return res;
}
inline string toBinStr(long long x) {
  string res = "";
  do res = (x % 2 ? "1" : "0") + res;
  while (x >>= 1LL);
  return res;
}
long long rnd(int k) {
  if (!k) return rand() % MAXV + 1;
  long long t = rand() % MAXV + 1;
  return (rand() % t) + (MAXV - t);
}
long long random_gen(int sign) {
  long long x = rnd(rand() % 2);
  long long s = rand() % 2;
  s = !s ? 1 : -1;
  return sign == 1 ? x : sign == -1 ? -x : s * x;
}
inline void debugArray(int a[], int n) {
  cerr << "array = ";
  for (int i = 0; i < n; ++i) cerr << a[i] << " ";
  cerr << "\n";
}
int calc(int x) { return x * (x + 1) / 2; }
int main() {
  int a, b, res = 1e9;
  cin >> a >> b;
  if (a > b) swap(a, b);
  for (int i = (a), _b = (b); i <= _b; i++)
    res = min(res, calc(i - a) + calc(b - i));
  cout << res;
}
