let input = ''; process.stdin.resume(); process.stdin.setEncoding('utf8') process.stdin.on('data', chunk => (input += chunk)); process.stdin.on('end', () => { const result = input .split(' ') .map(n => Number(n)) .map(v => { const fizz = !(v % 3); const buzz = !(v % 5); const fizzbuzz = (fizz << 1) + buzz; return [String(v).length, 4, 4, 8][fizzbuzz]; }).reduce((p, c) => p + c, 0); console.log(result); });