let sum = List.fold_left (+) 0;;
let read_int_ln _ = read_line () |> int_of_string;;

let () =   
	let (n, m) = Scanf.sscanf(read_line()) "%d %d" (fun x y -> (x, y)) in
	let rec get_a a i = 
		if i = n then List.rev a
		else (
			let row = Str.split (Str.regexp " ") (read_line ()) 
					 |> List.map int_of_string 
			in get_a (row :: a) (i + 1)
		) in
	let rec get_b b j = 
		if j = m then List.rev b 
		else get_b (read_int_ln () :: b) (j + 1) in 
	let a_vec = get_a [] 0 in
	let b_vec = get_b [] 0 in
	let solve a_row = List.map2 ( * ) a_row b_vec |> sum |> Printf.printf "%d\n" in
	List.iter solve a_vec
;;
