function Main(input) { var inp = input.split("\n"); inp = inp.map(x => parseInt(x)); var sum = 0; var i = 0; while (i < inp.length-1) { sum = sum + inp[i]; i++; } console.log(sum); } Main(require("fs").readFileSync("/dev/stdin", "utf8"));