const fs = require("fs")
const regEx = /mul\(\d+,\d+\)/g
let total = 0
const input = fs.readFileSync("input.txt","utf-8")
const result = input.match(regEx)
// console.log("hello world")
console.log(result)
result.forEach((mulString)=>{
    const numRegex= /\d+/g
    const numbers = mulString.match(numRegex)
    console.log(...numbers)
    const aVal =parseInt(numbers[0])
    const bVal=parseInt(numbers[1])
    total += aVal*bVal
})

console.log("total: ",total)