function Main(input) { input = input.split("\n"); var str = input[0]; res = 0; for (var i = 0; i < str.length; i++){ if (isNaN(str[i])){ continue; }else{ res += Number(str[i]); } } console.log("%d", res); } Main(require("fs").readFileSync("/dev/stdin", "utf8"));