Problem hidden

KLUG1 - COUNT JUMPS

Mr. Krish wants to count number of positions a knight can move in a chessboard of size n × m. He was too lazy to count possible positions manually, so he needs your help in finding the number of possible positions.

Help Mr. Krish to find total possible positions knight can move from current position in one move.

Constraints

1 <= n, m <= 100

1 <= a <= n

1 <= b <= m

Input

First line contains n and m. Where n is number of rows and m is number of columns of chessboard.

Next n lines contains 1’s and 0’s.

Next line contains a, b (current position of the knight)

Output

Print the number of possible positions knight can move to in one move.

Note:

Chessboard filled with only 1’s and 0’s:

  • 1 means that position is filled i.e. knight can't move to filled position.
  • 0 means knight can move to that position (empty position).

1-based indexing.

Example

Input:
4 4
1 0 1 0
0 1 1 1
1 1 0 1
0 1 1 1
3 3

Output:
4

Adicionado por:gopikrishna_p
Data:2017-08-25
Tempo limite:0.100s
Tamanho do fonte:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Linguagem permitida:Todas exceto: ASM64 CLOJURE ERL FSHARP PERL6 PY_NBC SCALA TCL
Origem:https://en.wikipedia.org/wiki/Knight_(chess)
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.