main = do
  line <- getLine
  let
    [n,m] = map read $ words line :: [Int]
    inmat i mat
      | i < n      = do
        line <- getLine
        inmat (i+1) (mat ++ [(map read $ words line :: [Int])])
      | otherwise  = do
        invec 0 [] mat
    invec i vec mat
      | i < m      = do
        line <- getLine
        invec (i+1) (vec ++ [(read $ head $ words line :: Int)]) mat
      | otherwise  = do
        mlt vec mat
    mlt vec mat
      | length mat /= 0  = do
        putStrLn $ show $ dotp vec (head mat)
        -- putStrLn $ (show vec) ++ (show mat)
        mlt vec (tail mat)
      | otherwise        = do
        putStr ""
    dotp a b = dotp_ a b 0
    dotp_ a b sum 
      | length a /= 0 && length b /= 0  = dotp_ (tail a) (tail b) (sum+((head a)*(head b)))
      | otherwise                       = sum
    in
      inmat 0 []

