#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, c = 0, s = 0, k = 0, p = 0, j, r, q, t, x = 0, y = 0, a, b = 0, f,
            d = 0, i;
  cin >> n >> m;
  if (abs(n - m) == 1)
    cout << "1";
  else {
    if (n > m) {
      j = n / m;
    } else {
      r = m / n;
    }
    if (n > m) {
      q = n - j;
      if (q > 1) {
        while (n != q) {
          n--;
          c++;
          s = s + c;
        }
        a = q - m;
        for (i = 1; i <= a; i++) {
          b = b + i;
        }
        cout << s + b;
      }
    } else if (m > n) {
      t = m - r;
      if (t > 1) {
        while (m != t) {
          m--;
          k++;
          p = p + k;
        }
        f = t - n;
        for (i = 1; i <= f; i++) {
          d = d + i;
        }
        cout << d + p;
      }
    }
  }
}
