main = interact $ unlines . show' . itp1_6_d . read' . lines
 where
  read' (nm:xs) = (map (map read . words) mat, map read vec)
   where
    n = read $ head $ words nm
    (mat,vec) = splitAt n xs
  show' = map show

itp1_6_d (mat,vec) = map (sum . zipWith (*) vec) mat