#include"iostream"
#include"vector"
#include"algorithm"
using namespace std;
typedef struct _POINT
{
int i;
int j;
int isto; //??????????????????????
int mp; //????????????,??????????????????????
int temp; //??????????
struct _POINT* h; //????????????
struct _POINT* nh; //????????????????
int p; //??????????
}POINT;
int mymax = 0; //????????????????????????????????????????,????????????????????????????????????????????????????????????????????????
void function1(int n, int x, int y);
int up(POINT** p, int x, int y, int n);
void dfs(POINT** p, vector<POINT*> v, int n);
void dfs2(POINT** p, vector<POINT*> v, POINT* d, POINT* g, int n);
void setH(POINT* p);
int main()
{
int n, x, y;
while(cin >> n >> x >> y)
{
function1(n, x, y);
}
}
void function1(int n, int x, int y)
{
POINT** p;
int temp;
int i, j;
POINT* maxP;
x--;
y--;
p = (POINT**)malloc(sizeof(POINT*) * n);
p[0] = (POINT*)malloc(sizeof(POINT) * n * n);
for (i = 0; i < n; i++)
{
p[i] = p[0] + i * n;
}
//??????????????
//??????????
for (i = 0; i < n; i++)
{
for (j = 0; j < n; j++)
{
cin >> temp;
p[i][j].p = temp;
p[i][j].isto = 0;
p[i][j].i = i;
p[i][j].j = j;
p[i][j].mp = 0;
p[i][j].temp = 0;
}
}
cout << up(p, x, y, n) << endl;
}
//????????
//??????????
int up(POINT **p, int x, int y, int n)
{
vector<POINT*> v;
POINT* g;
POINT* d;
int temp;
POINT* maxP;
int i, j;
vector<POINT*> a; //??????????
v.push_back(&p[x][y]);
temp = p[x][y].p;
p[x][y].p = 0;
p[x][y].h = NULL;
p[x][y].nh = NULL;
a.push_back(&p[x][y]);
while (1)
{
mymax = 0;
dfs(p, v, n);
maxP = &p[0][0];
for (i = 0; i < n; i++)
{
for (j = 0; j < n; j++)
{
p[i][j].isto = 0;
if (p[i][j].mp > maxP->mp)
{
maxP = &p[i][j];
}
}
}
if (maxP->mp <= 0)
{
break;
}
temp += maxP->mp;
while (maxP->h)
{
maxP->mp = maxP->temp = maxP->p = 0;
maxP = maxP->h;
}
}
return temp;
}
void dfs(POINT** p, vector<POINT*> v, int n)
{
POINT* d, * g;
int temp;
g = v.back();
//????????
if (g->i != 0)
{
d = &p[g->i - 1][g->j];
if (d->p)
{
dfs2(p, v, d, g, n);
}
}
//????
if (g->j != 0)
{
d = &p[g->i][g->j - 1];
if (d->p)
{
dfs2(p, v, d, g, n);
}
}
//????
if (g->i < n - 1)
{
d = &p[g->i + 1][g->j];
if (d->p)
{
dfs2(p, v, d, g, n);
}
}
//????
if (g->j < n - 1)
{
d = &p[g->i][g->j + 1];
if (d->p)
{
dfs2(p, v, d, g, n);
}
}
}
void dfs2(POINT** p, vector<POINT*> v, POINT* d, POINT *g, int n)
{
int temp;
if (find(v.begin(), v.end(), d) == v.end())
{
//????????????
//??????????????????????????????????????????????????????????????????????????
temp = g->temp + d->p;
d->nh = g;
if (!d->isto)
{
//???????????????????????????? ??????????????????????????
d->isto = 1;
d->mp = temp;
d->temp = temp;
d->h = g;
}
else
{
//??????????????????????
//????????????????
d->temp = temp;
if (d->temp > d->mp)
{
//??????????????????????????????????????????????????
d->mp = d->temp;
}
}
if (temp > mymax)
{
//??????????????????????
setH(d);
mymax = temp;
}
v.push_back(d);
dfs(p, v, n);
}
}
//????????????????
void setH(POINT *p)
{
while (p->nh)
{
p->h = p->nh;
p = p->h;
}
return;
}