public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] in = br.readLine().split(" ");
		int row = Integer.parseInt(in[0]);
		int col = Integer.parseInt(in[1]);
		int[][] inArr = new int[row][col];
		for (int i = 0; i < row; i++) {
			String[] rowS = br.readLine().split(" ");
			for (int j = 0; j < col; j++) {
				inArr[i][j] = Integer.parseInt(rowS[j]);
			}
		} 
		int max = Integer.MIN_VALUE;
		for (int i = 0; i < col; i++) {
			int[] row_sum = new int[row];
			for (int j = i; j < col; j++) {
				for (int k = 0 ; k < row; k++) {
					row_sum[k] = inArr[k][j] + row_sum[k];
				}
				int max_curr = getMaxSum(row_sum);
				max = max > max_curr ? max : max_curr;
			}
		}
		System.out.println(max);
	}