s = io.read() n = string.len(s) pos = 1 a, pos, num = string.find(s, "(%d+)") num = tonumber(num) while(pos < n) do pos = pos + 1 op = string.sub(s, pos, pos) pos = pos + 1 a, pos, b = string.find(s, "(%d+)", pos) b = tonumber(b) if(op == "*") then num = num + b else num = num * b end end print(num)