import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); static void myout(Object t){System.out.println(t);}//standard output static void myerr(Object t){System.err.println(t);}//standard error static String getStr(){return sc.next();} static int getInt(){return Integer.parseInt(getStr());} static long getLong(){return Long.parseLong(getStr());} static boolean hasNext(){return sc.hasNext();} static char[] mySplit(String str){return str.toCharArray();} public static void main(String[] args){ int N = getInt(); int M = getInt(); String op = getStr(); ArrayList mlist = new ArrayList(); ArrayList nlist = new ArrayList(); for(int i = 0; i < M; i++){ mlist.add(getInt()); } for(int i = 0; i < N; i++){ nlist.add(getInt()); } for(int i = 0; i < N; i++){ String output = ""; for(int j = 0; j < M; j++){ long val; if(op.equals("+")){ val = nlist.get(i) + mlist.get(j); }else{ val = nlist.get(i) * mlist.get(j); } if(j == 0){ output += val; }else{ output += " " + val; } } myout(output); } } //Method addition frame start //Method addition frame end }