solve a b = [sum $ map (\(y,z) -> y*z) (zip x b) | x <- a]
main = do
    [n, m] <- fmap (map read . words) getLine
    a <- fmap (map (map read) . map words) $ mapM (\_ -> getLine) [1..n]
    b <- fmap (concat. map (map read) . map words) $ mapM (\_ -> getLine) [1..m]
    putStr $ unlines $ map show $ solve a b


