local n, m = io.read("*n", "*n", "*l") local str = io.read() local op = str:sub(1, 1) local b = {} for s in str:gmatch("(%d+)") do table.insert(b, tonumber(s)) end local a = {} for i = 1, n do a[i] = io.read("*n") end for i = 1, n do for j = 1, m do local v = op == "+" and a[i] + b[j] or (0LL + a[i]) * b[j] local z = tostring(v):gsub("LL", "") io.write(z) io.write(j == m and "\n" or " ") end end