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

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

n.times{
a << gets.chomp.split.map(&:to_i)
}

m.times{
b << gets.split.map(&:to_i)
}

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