let () =
  let n, m = Scanf.sscanf (read_line()) "%d %d" (fun n m -> n,m) in
  let rec read_matrix acc_matrix i =
    if i < n then
      begin
        let row = List.map int_of_string (Str.split (Str.regexp " ") (read_line())) in
        read_matrix (row :: acc_matrix) (i + 1)
      end
    else
      acc_matrix
  in
  let matrix = read_matrix [] 0 in
  let rec read_vector acc_vector i =
    if i < m then
      read_vector (( int_of_string (read_line()) )::acc_vector) (i + 1)
    else acc_vector
  in
  let vector = List.rev (read_vector [] 0) in
  let rec mul_vector v1 v2 sum=
    match v1 with
    |[] -> sum
    |h1::t1 -> match v2 with
             |[] -> sum
             |h2::t2 -> mul_vector t1 t2 (h1*h2 + sum)
  in
  let rec mul_matrix matrix vector ans_vector =
    match matrix with
    |[] -> ans_vector
    |hd::tl -> mul_matrix tl vector ((mul_vector hd vector 0)::ans_vector)
  in
  let ans_vector = mul_matrix matrix vector [] in
  let rec print_answer ans_vector =
    match ans_vector with
    |[] -> ()
    |h::d -> print_int h;
             print_string "\n";
             print_answer d;
  in
  print_answer ans_vector
;;
