n, m = gets.chomp.split.map(&:to_i)

a = Array.new(n){Array.new(m)}
b = Array.new(m)

for i in 0..n
for j in 0..m
a[i][j] = gets.chomp.split.map(&:to_i)
end
end

for i in 0..m
b[i] = gets.to_i
end

s = 0
for i in 0..n
for j in 0..m
 s +=a[i][j] * b[j]
end 
puts s
end
