"use strict";

/**
 * Resolves problem.
 * @param  {string} input
 * @returns {string}
 */
var main = function(input) {
    const params = input.split(" ").map(x => parseInt(x));
    const a = params[0];
    const b = params[1];

    const difference = b - a;
    let height = 0;
    for (let i = 1; i < 1000; i++) {
        height = height + i;
        if ((i + 1) === difference) {
            return height - a;
        }
    }
};

const output = main(require("fs").readFileSync("/dev/stdin", "utf8"));
console.log(output); // console.log outputs with trailing new line!
