import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		// ?????????????????\????????????
		Scanner sc = new Scanner(System.in);

		// ??????????????\??????????????°?????\???????????°
		int lin = sc.nextInt();
		int col = sc.nextInt();

		// ????¬???????????????????
		int[][] grid = new int[lin + 1][col];

		// ????¬???????????????????lft:?????????????????????rgt:?????????????????????
		int lft;
		int rgt;

		// ??\??????????????°?????????????????\??????
		for (lft = 0; lft <= lin; lft++) {

			for (rgt = 0; rgt < col; rgt++) {

				grid[lft][rgt] = sc.nextInt();

			}
		}

		// ????¨??????\?????????????????????
		int[] sum = new int[lin];

		// ???????????????
		for (lft = 0; lft < lin; lft++) {

			for (rgt = 0; rgt < col; rgt++) {

				sum[lft] += grid[lft][rgt] * grid[lin][rgt];

			}
			System.out.println(sum[lft]);
		}
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		// ?????????????????\????????????
		Scanner sc = new Scanner(System.in);

		// ??????????????\??????????????°?????\???????????°
		int lin = sc.nextInt();
		int col = sc.nextInt();

		// ????¬???????????????????
		int[][] grid = new int[lin + 1][col];

		// ????¬???????????????????lft:?????????????????????rgt:?????????????????????
		int lft;
		int rgt;

		// ??\??????????????°?????????????????\??????
		for (lft = 0; lft <= lin; lft++) {

			for (rgt = 0; rgt < col; rgt++) {

				grid[lft][rgt] = sc.nextInt();

			}
		}

		// ????¨??????\?????????????????????
		int[] sum = new int[lin];

		// ???????????????
		for (lft = 0; lft < lin; lft++) {

			for (rgt = 0; rgt < col; rgt++) {

				sum[lft] += grid[lft][rgt] * grid[lin][rgt];

			}
			System.out.println(sum[lft]);
		}
		sc.close();
	}
} Main public static void main(String[] args) {

		// ?????????????????\????????????
		Scanner sc = new Scanner(System.in);

		// ??????????????\??????????????°?????\???????????°
		int lin = sc.nextInt();
		int col = sc.nextInt();

		// ????¬???????????????????
		int[][] grid = new int[lin + 1][col];

		// ????¬???????????????????lft:?????????????????????rgt:?????????????????????
		int lft;
		int rgt;

		// ??\??????????????°?????????????????\??????
		for (lft = 0; lft <= lin; lft++) {

			for (rgt = 0; rgt < col; rgt++) {

				grid[lft][rgt] = sc.nextInt();

			}
		}

		// ????¨??????\?????????????????????
		int[] sum = new int[lin];

		// ???????????????
		for (lft = 0; lft < lin; lft++) {

			for (rgt = 0; rgt < col; rgt++) {

				sum[lft] += grid[lft][rgt] * grid[lin][rgt];

			}
			System.out.println(sum[lft]);
		}
		sc.close();
	} main {

		// ?????????????????\????????????
		Scanner sc = new Scanner(System.in);

		// ??????????????\??????????????°?????\???????????°
		int lin = sc.nextInt();
		int col = sc.nextInt();

		// ????¬???????????????????
		int[][] grid = new int[lin + 1][col];

		// ????¬???????????????????lft:?????????????????????rgt:?????????????????????
		int lft;
		int rgt;

		// ??\??????????????°?????????????????\??????
		for (lft = 0; lft <= lin; lft++) {

			for (rgt = 0; rgt < col; rgt++) {

				grid[lft][rgt] = sc.nextInt();

			}
		}

		// ????¨??????\?????????????????????
		int[] sum = new int[lin];

		// ???????????????
		for (lft = 0; lft < lin; lft++) {

			for (rgt = 0; rgt < col; rgt++) {

				sum[lft] += grid[lft][rgt] * grid[lin][rgt];

			}
			System.out.println(sum[lft]);
		}
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int lin = sc.nextInt(); lin sc.nextInt() sc.nextInt sc int col = sc.nextInt(); col sc.nextInt() sc.nextInt sc int[][] grid = new int[lin + 1][col]; grid new int[lin + 1][col] lin + 1 lin 1 col int lft; lft int rgt; rgt for (lft = 0; lft <= lin; lft++) {

			for (rgt = 0; rgt < col; rgt++) {

				grid[lft][rgt] = sc.nextInt();

			}
		} lft = 0; lft = 0 lft 0 lft <= lin lft lin lft++ lft++ lft {

			for (rgt = 0; rgt < col; rgt++) {

				grid[lft][rgt] = sc.nextInt();

			}
		} {

			for (rgt = 0; rgt < col; rgt++) {

				grid[lft][rgt] = sc.nextInt();

			}
		} for (rgt = 0; rgt < col; rgt++) {

				grid[lft][rgt] = sc.nextInt();

			} rgt = 0; rgt = 0 rgt 0 rgt < col rgt col rgt++ rgt++ rgt {

				grid[lft][rgt] = sc.nextInt();

			} {

				grid[lft][rgt] = sc.nextInt();

			} grid[lft][rgt] = sc.nextInt() grid[lft][rgt] grid[lft] grid lft rgt sc.nextInt() sc.nextInt sc int[] sum = new int[lin]; sum new int[lin] lin for (lft = 0; lft < lin; lft++) {

			for (rgt = 0; rgt < col; rgt++) {

				sum[lft] += grid[lft][rgt] * grid[lin][rgt];

			}
			System.out.println(sum[lft]);
		} lft = 0; lft = 0 lft 0 lft < lin lft lin lft++ lft++ lft {

			for (rgt = 0; rgt < col; rgt++) {

				sum[lft] += grid[lft][rgt] * grid[lin][rgt];

			}
			System.out.println(sum[lft]);
		} {

			for (rgt = 0; rgt < col; rgt++) {

				sum[lft] += grid[lft][rgt] * grid[lin][rgt];

			}
			System.out.println(sum[lft]);
		} for (rgt = 0; rgt < col; rgt++) {

				sum[lft] += grid[lft][rgt] * grid[lin][rgt];

			} rgt = 0; rgt = 0 rgt 0 rgt < col rgt col rgt++ rgt++ rgt {

				sum[lft] += grid[lft][rgt] * grid[lin][rgt];

			} {

				sum[lft] += grid[lft][rgt] * grid[lin][rgt];

			} sum[lft] += grid[lft][rgt] * grid[lin][rgt] sum[lft] sum lft grid[lft][rgt] * grid[lin][rgt] grid[lft][rgt] grid[lft] grid lft rgt grid[lin][rgt] grid[lin] grid lin rgt System.out.println(sum[lft]) System.out.println System.out System System.out sum[lft] sum lft sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {

		// ?????????????????\????????????
		Scanner sc = new Scanner(System.in);

		// ??????????????\??????????????°?????\???????????°
		int lin = sc.nextInt();
		int col = sc.nextInt();

		// ????¬???????????????????
		int[][] grid = new int[lin + 1][col];

		// ????¬???????????????????lft:?????????????????????rgt:?????????????????????
		int lft;
		int rgt;

		// ??\??????????????°?????????????????\??????
		for (lft = 0; lft <= lin; lft++) {

			for (rgt = 0; rgt < col; rgt++) {

				grid[lft][rgt] = sc.nextInt();

			}
		}

		// ????¨??????\?????????????????????
		int[] sum = new int[lin];

		// ???????????????
		for (lft = 0; lft < lin; lft++) {

			for (rgt = 0; rgt < col; rgt++) {

				sum[lft] += grid[lft][rgt] * grid[lin][rgt];

			}
			System.out.println(sum[lft]);
		}
		sc.close();
	}
} public class Main {

	public static void main(String[] args) {

		// ?????????????????\????????????
		Scanner sc = new Scanner(System.in);

		// ??????????????\??????????????°?????\???????????°
		int lin = sc.nextInt();
		int col = sc.nextInt();

		// ????¬???????????????????
		int[][] grid = new int[lin + 1][col];

		// ????¬???????????????????lft:?????????????????????rgt:?????????????????????
		int lft;
		int rgt;

		// ??\??????????????°?????????????????\??????
		for (lft = 0; lft <= lin; lft++) {

			for (rgt = 0; rgt < col; rgt++) {

				grid[lft][rgt] = sc.nextInt();

			}
		}

		// ????¨??????\?????????????????????
		int[] sum = new int[lin];

		// ???????????????
		for (lft = 0; lft < lin; lft++) {

			for (rgt = 0; rgt < col; rgt++) {

				sum[lft] += grid[lft][rgt] * grid[lin][rgt];

			}
			System.out.println(sum[lft]);
		}
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		// ?????????????????\????????????
		Scanner sc = new Scanner(System.in);

		// ??????????????\??????????????°?????\???????????°
		int lin = sc.nextInt();
		int col = sc.nextInt();

		// ????¬???????????????????
		int[][] grid = new int[lin + 1][col];

		// ????¬???????????????????lft:?????????????????????rgt:?????????????????????
		int lft;
		int rgt;

		// ??\??????????????°?????????????????\??????
		for (lft = 0; lft <= lin; lft++) {

			for (rgt = 0; rgt < col; rgt++) {

				grid[lft][rgt] = sc.nextInt();

			}
		}

		// ????¨??????\?????????????????????
		int[] sum = new int[lin];

		// ???????????????
		for (lft = 0; lft < lin; lft++) {

			for (rgt = 0; rgt < col; rgt++) {

				sum[lft] += grid[lft][rgt] * grid[lin][rgt];

			}
			System.out.println(sum[lft]);
		}
		sc.close();
	}
}