function solution(a, b) {
let middleNum = 0;
if (a < b) {
for (let i = 1; i < b - a; i++) {
middleNum += a + i;
}
} else {
for (let i = 1; i < a - b; i++) {
middleNum += b + i;
}
}
const answer = a !== b ? a + middleNum + b : a;
return answer;
}
function adder(a, b) {
return ((a + b) * (Math.abs(b - a) + 1)) / 2;
}
function adder(a, b, s = 0) {
for (var i = Math.min(a, b); i <= Math.max(a, b); i++) s += i;
return s;
}