The King of the North

No attempts yetTime limit1sMemory limit128 MB

Problem

Winter is coming (or going, who can be sure these days) and a new king rises in the North. News travels fast now, so you, the rising king, have little time left. You have to rally your bannermen behind you. One question turns out to be harder than you first expected. How large a kingdom can you claim, and how many men should you send for?

Your advisors have already studied the land and worked out, for every square of the map, how many bannermen it takes to fully defend that square against your foes. You are a loving and caring king, so you want as few men as possible to serve in your army. To give your war council a fair chance of picking the best kingdom, you have to name the size of your army right away.

Luckily, armies are not that advanced yet. An enemy army marches only horizontally or vertically, so it can never slip diagonally between two fully defended squares. Your kingdom counts as defended when no route reaches your castle from anywhere outside the map without passing through a fully defended square. A square labelled 00 is a high mountain or a wall that nobody would be foolish enough to climb, so it stays safe with no bannermen on it. You have no idea what lurks beyond the borders of the map, so assume the worst and plan as if you could never hold a single position outside the map.

You do not have to work out the shape of the kingdom or the squares your bannermen stand on. Your war council settles that. Report only the size of the army. The square holding your castle is the thing you protect, so it never counts toward the army.

Input

The input is the rectangular strategic map your advisors came up with.

The first line has two integers RR and CC (3R,C3003 \le R, C \le 300), the number of rows and columns of the map. Each of the next RR lines has CC integers, where cic_i is the number of bannermen needed to defend that square (0ci1000000 \le c_i \le 100\,000). The last line has two integers rr and cc (0<r<R10 < r < R - 1, 0<c<C10 < c < C - 1), the position of your own castle. Rows and columns are numbered from 00.

Output

Print one integer on a single line, the smallest army that defends a kingdom around your castle.