eval是个好东西

let line
while(line=readline()) {
    line = line.replace('{','(').replace('}',')')
    console.log(eval(line))
}