function Main(input) {
    input = input.split("\n");
    for (i=0; i < input.length; i=i+n+m+2) {
        tmp = input[i].split(" ")
        var n = parseInt(tmp[0])
        var m = parseInt(tmp[1])
        var A =[]
        for (j=i+1; j < n+1; j++) {
            tmpp = input[j].split(" ")
            var a = 0
            for (k=0; k < m; k++) {
                var b = parseInt(input[i+n+k+1])
                var e = parseInt(tmpp[k])
                a = a+b*e
            }
            A.push(a)
        }
        for (l=0; l < A.length; l++) {
            console.log(A[l])
        }
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

