const input = require('fs') .readFileSync('/dev/stdin', 'utf8'); const [A, B, C, D] = input .split(/\s/) .map(v => +v); let count = 0; for (let i = A; i <= B; i++) { for (let j = C; j <= D; j++) { if (i !== j) count++; } } console.log(count);