defmodule Main do def main do IO.read(:line) |> String.trim() |> solve |> IO.puts() end def solve(s) do {n, rest} = s |> Integer.parse() solve_rec(n, rest) end def solve_rec(acc, "") do acc end def solve_rec(acc, rest) do {h, t} = rest |> String.split_at(1) {n, rest2} = t |> Integer.parse() case h do "*" -> solve_rec(acc + n, rest2) "+" -> solve_rec(acc * n, rest2) end end end