defmodule Main do def main do [n, m] = IO.gets("") |> String.trim() |> String.split() |> Enum.map(&String.to_integer(&1)) [op | b] = IO.gets("") |> String.trim() |> String.split() b = b |> Enum.map(&String.to_integer(&1)) Enum.each(1..n, fn _ -> a = IO.gets("") |> String.trim() |> String.to_integer() if op == "+", do: Enum.map(b, &(&1 + a)) |> Enum.join("\n") |> IO.puts(), else: Enum.map(b, &(&1 * a)) |> Enum.join("\n") |> IO.puts() end) end end