using System;
using System.Collections.Generic;
namespace takmicenjeKvalifikacije
{
    internal class Program
    {
        static void Main(string[] args)
        {

            int n = int.Parse(Console.ReadLine());
            int m = int.Parse(Console.ReadLine());

            int[,] matrix = new int[n, m];
            for (int i = 0; i < n; i++)
            {
                string[] row = Console.ReadLine().Split();
                for (int j = 0; j < m; j++)
                {
                    matrix[i, j] = int.Parse(row[j]);
                }
            }

            int x = int.Parse(Console.ReadLine()) - 1;
            int y = int.Parse(Console.ReadLine()) - 1; 

            int[,] minFans = new int[n, m];

            minFans[0, 0] = matrix[0, 0];

            for (int j = 1; j < m; j++)
            {
                minFans[0, j] = minFans[0, j - 1] + matrix[0, j];
            }

            for (int i = 1; i < n; i++)
            {
                minFans[i, 0] = minFans[i - 1, 0] + matrix[i, 0];
            }
            for (int i = 1; i < n; i++)
            {
                for (int j = 1; j < m; j++)
                {
                    if (i != x || j != y)
                    {
                        minFans[i, j] = Math.Min(minFans[i - 1, j], minFans[i, j - 1]) + matrix[i, j];
                    }
                    else
                    {
                        minFans[i, j] = int.MaxValue;
                    }
                }
            }
            Console.WriteLine(minFans[n - 1, m - 1]);
        }
    }
}