17 lines
304 B
JavaScript
17 lines
304 B
JavaScript
var input = require("fs").readFileSync("input.txt").toString();
|
|
var nums = input.split("\n").filter(a=>(a)).map(a=>(parseInt(a)));
|
|
var seen = {};
|
|
var total = 0;
|
|
while(true){
|
|
for(var i of nums){
|
|
total += i;
|
|
if(!seen[total]){
|
|
seen[total]=1;
|
|
}
|
|
else{
|
|
console.log(total);
|
|
return 0;
|
|
}
|
|
}
|
|
}
|