#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, k, g, flag;
  scanf("%d %d", &a, &b);
  int ans = 0;
  if ((a + b) % 2 == 0) {
    flag = 0;
    k = (a + b) / 2 - min(a, b);
    for (int i = 1; i <= k; i++) ans += i;
  }
  if ((a + b) % 2 == 1) {
    flag = 1;
    k = (a + b - 1) / 2;
    a = a - k;
    b = b - k;
    for (int i = 1; i <= a; i++) ans += i;
    for (int j = 1; j <= b; j++) ans += j;
  }
  if (flag)
    printf("%d\n", ans);
  else
    printf("%d\n", ans * 2);
  return 0;
}
