function Main(input) { var sum = 0; while(input > 0) { sum += parseInt(input); input--; } console.log(sum); } Main(require('fs').readFileSync('/dev/stdin', 'utf8'));