main = do
    sn <- getLine
    cs <- getContents
    let n = read . head $ words sn
    let (as,bs) = splitAt n $ zipWith ($) (repeat $ (map read) . words) (lines cs) 
    putStr $ unlines $ map show $ map (sum . zipWith (*) (concat bs)) as