import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); String s = sc.next(); long[] b = new long[m]; for (int i = 0; i < b.length; i++) { b[i] = sc.nextLong(); } long[] a = new long[n]; for (int i = 0; i < a.length; i++) { a[i] = sc.nextLong(); } sc.close(); for (int i = 0; i < a.length; i++) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < b.length; j++) { if ("+".equals(s)) { sb.append(a[i] + b[j]).append(' '); } else { sb.append(a[i] * b[j]).append(' '); } } sb.deleteCharAt(sb.length() - 1); System.out.println(sb.toString()); } } }