defmodule Main do def main do [n, m] = IO.read(:line) |> String.trim() |> String.split() |> Enum.map(&String.to_integer/1) [op, bm] = IO.read(:line) |> String.trim() |> String.split() |> (fn [op | tail] -> [op, Enum.map(tail, &String.to_integer/1)] end).() an = for _ <- 1..n, do: IO.read(:line) |> String.trim() |> String.to_integer() solve(m, n, op, bm, an) |> Enum.map_join("\n", &(Enum.join(&1, " "))) |> IO.puts() end def solve(_m, _n, op, bm, an) do Enum.map(an, fn ai -> Enum.map(bm, fn bj -> case op do "+" -> ai + bj "*" -> ai * bj end end) end) end end