using System; public class Hello { static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var n = int.Parse(line[0]); var m = int.Parse(line[1]); var a = new long[m]; line = Console.ReadLine().Trim().Split(' '); var op = line[0]; for (int i = 1; i <= m; i++) a[i - 1] = int.Parse(line[i]); var ans = new long[m]; for (int i = 0; i < n; i++) { var t = long.Parse(Console.ReadLine().Trim()); for (int j = 0; j < m; j++) ans[j] = op == "+" ? a[j] + t : a[j] * t; Console.WriteLine(string.Join(" ", ans)); } } }