Babushka and Wassup have been playing an 'n x n' scrabble game for some time. Cells with letters are marked as 1 and empty ones are 0.
Now they call their friend Mumbasa to solve a challenge. Her goal is to count the number of words with exactly X characters solved on the board.
Input format:
First line contains the size of the matrix i.e. n
Each of the next 'n' line contain a string of 0 and 1s.
The length of the string is also 'n' as its an n x n matrix.
The last line i.e. 'n+2' line conatins X i.e. the size of the words to search for.
Output Format:
Output should be the count of number of words with exactly X characters.
Constraints:
0 < n <= 100
Sample input 1:
5
00100
11100
10111
10010
11111
3
Smaple Output 1:
4
Sample Explanation 1:
The 5x5 matrix is as follows. Upper top left is coordinate(1,1) and bottom right corner is coordinate (nxn).
00100
11100
10111
10010
11111
There are 4 words of size 3(Horizontal: starting at 2x1 and 3x3; Vertical: starting at 1x3 and 3x4)