import java.util.* fun main(args:Array){ val (n,m) = readLine()!!.split(" ").map{it.toInt()} val tmp = readLine()!!.split(" ") val op = tmp[0] val b = tmp.drop(1).map{it.toLong()} val a = LongArray(n) for(i in 0 until n){ a[i] = readLine()!!.toLong() } val ans = Array(n){LongArray(m)} for(i in 0 until n){ for(j in 0 until m){ if(j != 0) print(" ") print(if(op == "+") a[i] + b[j] else a[i] * b[j]) } println() } }