n,m=[int(i) for i in input().split()]

A=[]

b=[]

for i in range(n):

	A.append([int(j) for j in input().split()])



for i in range(m):

	b.append(int(eval(input())))



for i in range(n):

	s=0

	for j in range(m):

		s+=A[i][j]*b[j]

	print(s)
a,b=list(map(int,input().split()))

A=[]

B=[]

for i in range(a):

	A.append([int(j) for j in input().split()])



for i in range(b):

	B.append(int(eval(input())))





for i in range(a):

	s=0

	for j in range(b):

		s+=A[i][j]*B[j]

	print(s)
n, m = [int(i) for i in input().split()]
A = []
b = []
for i in range(n):
    A.append([int(j) for j in input().split()])
for i in range(m):
    b.append(int(eval(input())))
for i in range(n):
    s = 0
    for j in range(m):
        s += A[i][j] * b[j]
    print(s)

a, b = list(map(int, input().split()))
A = []
B = []
for i in range(a):
    A.append([int(j) for j in input().split()])
for i in range(b):
    B.append(int(eval(input())))
for i in range(a):
    s = 0
    for j in range(b):
        s += A[i][j] * B[j]
    print(s)

-n, m = [int(i) for i in input().split()] +a, b = list(map(int, input().split())) -b = [] -for i in range(n): +B = [] +for i in range(a): -for i in range(m): -    b.append(int(eval(input()))) -for i in range(n): +for i in range(b): +    B.append(int(eval(input()))) +for i in range(a): -    for j in range(m): -        s += A[i][j] * b[j] +    for j in range(b): +        s += A[i][j] * B[j]