// Arup Guha
// 12/17/2017
// Solution to 2017 NCPC Problem E: Emptying the Baltic

import java.util.*;
import java.io.*;

public class e {

	// Ways water can flow.
	final public static int[] DX = {-1,-1,-1, 0,0, 1,1,1};
	final public static int[] DY = {-1, 0, 1,-1,1,-1,0,1};

	// Stores grid.
	public static int r;
	public static int c;
	public static long[][] grid;

	public static entry[][] depth;

	public static void main(String[] args) throws Exception {

		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer tok = new StringTokenizer(stdin.readLine());
		r = Integer.parseInt(tok.nextToken());
		c = Integer.parseInt(tok.nextToken());
		grid = new long[r][c];

		// Read in the grid.
		for (int i=0; i<r; i++) {
			tok = new StringTokenizer(stdin.readLine());
			for (int j=0; j<c; j++)
				grid[i][j] = Long.parseLong(tok.nextToken());
		}

		// Where we start.
		tok = new StringTokenizer(stdin.readLine());
		int sx = Integer.parseInt(tok.nextToken())-1;
		int sy = Integer.parseInt(tok.nextToken())-1;

		// Store answers here.
		depth = new entry[r][c];
		for (int i=0; i<r; i++)
			for (int j=0; j<c; j++)
				depth[i][j] = new entry(i,j,0);

		// We drain from here first.
		depth[sx][sy] = new entry(sx,sy,(int)grid[sx][sy]);

		// Set up Priority Queue.
		long res = 0;
		PriorityQueue<entry> pq = new PriorityQueue<entry>();
		pq.offer(depth[sx][sy]);

		// Stores which square's depths have been finalized.
		boolean[][] used = new boolean[r][c];

		// Run Algorithm.
		while (pq.size() > 0) {

			// Get the next finalized square and add to result.
			entry cur = pq.poll();

			// Done already.
			if (used[cur.x][cur.y]) continue;
			if (grid[cur.x][cur.y] > 0) break;

			res -= cur.d;
			used[cur.x][cur.y] = true;

			// See if we can drain more from neighbors.
			for (int i=0; i<DX.length; i++) {
				int nx = cur.x + DX[i];
				int ny = cur.y + DY[i];
				if (!inbounds(nx, ny) || used[nx][ny]) continue;
				if (grid[nx][ny] > 0) continue;
				if (depth[nx][ny].d > cur.d) {
					depth[nx][ny].d = Math.max(cur.d, (int)grid[nx][ny]);
					pq.offer(depth[nx][ny]);
				}
			}
		}

		System.out.println(res);
	}

	public static boolean inbounds(int x, int y) {
		return x >= 0 && x < r && y >= 0 && y < c;
	}
}

class entry implements Comparable<entry> {

	public int x;
	public int y;
	public int d;

	public entry(int myx, int myy, int myd) {
		x = myx;
		y = myy;
		d = myd;
	}

	public int compareTo(entry other) {
		return this.d - other.d;
	}
}