nu=input().split(” “)
n=int(nu[0])
m=int(nu[1])
k=int(nu[2])
map1=[]
for i in range(n):
s=input().split(” “)
ls1=[]
for j in s:
ls1.append(eval(j))
map1.append(ls1)
ans=0
MOD=1000000007
def dfs(x,y,goods,max1):
if(x==n or y==m or goods>k):
return
nu=map1[x][y]
if(x==n-1 and y==m-1):
if(goods==k or (k-1==goods and max1<nu)):
global ans
global MOD
ans+=1
ans%=MOD
return
if(max1<nu):
dfs(x,y+1,goods+1,nu)
dfs(x+1,y,goods+1,nu)
dfs(x+1,y,goods,max1)
dfs(x,y+1,goods,max1)
dfs(0,0,0,-1)
print(ans)