function Main (input) {
  const inputValue = input.split(/\s/g).map(num => parseInt(num));
  const west = inputValue[0];
  const east = inputValue[1];
  if (west < 499500 && east < 499500) {
    const diff = east - west;
    const eastTowerHight = new Array(diff).fill('').map((value, index) => index + 1).reduce((prev, current) => prev + current);
    console.log('%s', eastTowerHight - east);
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
