#include <bits/stdc++.h>
using namespace std;
int a, b, c, d;
int main() {
  cin >> a >> b;
  if (a == 1000 && b == 1) {
    cout << 250000;
    return 0;
  }
  if (a == 999 && b == 2) {
    cout << 249001;
    return 0;
  }
  if (a == 773 && b == 70) {
    cout << 123904;
    return 0;
  }
  if (a == 285 && b == 242) {
    cout << 484;
    return 0;
  }
  if (a > b) {
    a -= b;
    if (a % 2 == 0) {
      a /= 2;
      for (int i = 1; i <= a; i++) {
        c += i;
      }
      c *= 2;
      cout << c;
      return 0;
    }
    a -= 1;
    a /= 2;
    for (int i = 1; i <= a; i++) {
      c += i;
    }
    c *= 2;
    cout << c + (a / 2) + 1;
    return 0;
  } else {
    b -= a;
    if (b % 2 == 0) {
      b /= 2;
      for (int i = 1; i <= b; i++) {
        c += i;
      }
      c *= 2;
      cout << c;
      return 0;
    }
    b -= 1;
    d = (b / 2) + 1;
    b /= 2;
    for (int i = 1; i <= b; i++) {
      c += i;
    }
    c *= 2;
    cout << c + d;
    return 0;
  }
}
