During 20th Century FinnyLand was the most peaceful place on the earth but in the early 21st Century bad aliens came from YGT planet to Destroy Finnyland . Aliens from YGT planet has destroyed nearly all the paths in FinnyLand.
Finny the Little Monster resident of Finnyland wants to escape FinnyLand.Finnyland is M x N grid like Structure in which if you can move in four directions from one point to another. Four Directions are UP, DOWN , RIGHT , LEFT. Now Some points are destroyed by Aliens and Finny cannot go to those pointes.
Now Finny is standing at starting point and he want to escape the Finnyland in exactly K minutes because the main gate of city will be open exactly at Kth minute and then again closes.If Finny takes a turn it will take a minute i.e.. if he is moving in RIGHT direction and and if he takes a LEFT,UP OR DOWN this will count as a turn. Travelling from one point to another doesn't take any time.
Finny wants to know the number of ways to escape the Finnyland.A way is different if the sequence of turns is different. Can you help finny to solve the problem.
Start Point : (1,1) according to 1-based indexing End Point : (M,N) according to 1-based indexing
Note : Once reached at gate at any moment Finny cannot go back. Print answer by taking its modulo with 10^9+7
Constraints:
1<=M,N<=100 1<=k<=1000
Time Limit : 1 sec
Input :
First line contains 3 space seperated integers N,M,K
Next each of N lines contains M characters from set { '.' , 'x'}
'.' denotes points not destroyed by Aliens
'x' denotes points destroyed by Aliens
Ouput :
Output one integer modulo 1000000007 denoting answer to the above problem.
Sample Input 1 :
2 2 2
.x
..
Sample Output 1 :
0
Sample Input 2 :
2 2 3
.x
..
Sample Output 2 :
1
Sample Input 3 :
3 3 4
..x
..x
x..
Sample Output 3 :
6
Explanation 1 :
There is no possible path with 2 turns. Though there is possible path with only 1 turn.
Explanation 2 :
There is only 1 path with 3 turns. Path : (1,1) - (2,1) - (1,1) - (2,1) - (2,2)
NOTE : Use int instead of long long int
Author-Chanchur Bansal