process.stdin.resume(); process.stdin.setEncoding('utf8'); var lines = []; var reader = require('readline').createInterface({ input: process.stdin, output: process.stdout }); reader.on('line', (line) => { lines.push(line); }); reader.on('close', () => { let sum = 0; //合計 let n = lines[0]; for (i = 0; i <= n; i++) { sum += i; } console.log(sum); //15 });