main = interact $ unlines . show' . solve . read' . lines
  where
    solve (matrix, vector) = map (sum . zipWith (*) vector) matrix
    show' = map show
    read' (nm:xs) = (map (map read .words) matrix, map read vector)
      where
        (matrix, vector) = splitAt n xs
        n = head . (map read) . words $ nm
