import Data.Array.IO
import Control.Monad

main = do
  s <- getLine
  let [n,m] = map (read::String->Int) . words $ s
  s <- replicateM n getLine
  t <- replicateM m getLine

  let mult x = show $ sum $ zipWith (*) (map (read::String->Int) . words $ x) (map (read::String->Int) $ t)
  mapM_ putStrLn $ map mult s