import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); boolean isPlus = (sc.next().charAt(0) == '+'); long[] colums = new long[m]; for (int i = 0; i < m; i++) { colums[i] = sc.nextInt(); } int[] rows = new int[n]; for (int i = 0; i < n; i++) { rows[i] = sc.nextInt(); } StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (j > 0) { sb.append(" "); } long value; if (isPlus) { value = colums[j] + rows[i]; } else { value = colums[j] * rows[i]; } sb.append(value); } sb.append("\n"); } System.out.print(sb); } }