object Main extends App {
    val x :: y = io.Source.stdin.getLines.map(_.split(" ").map(_.toInt)).toList
    val a = y.take(x(0))
    val b = y.drop(x(0)).flatten
    a.foreach(x => println(x.zip(b).map(p => p._1 * p._2).sum))
}