import java.util.Scanner object Main extends App { val sc = new Scanner(System.in) val n = sc.nextInt val m = sc.nextInt val op = sc.next val arr = Array.fill(m)(sc.nextInt) val brr = Array.fill(n)(sc.nextInt) val opf = op match { case "+" => (x:Int, y:Int) => (x + y) case "*" => (x:Int, y:Int) => (x * y) } brr.map(b => println(arr.map(a => opf(a, b)).mkString(" "))) }