#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
using LL = long long;
const int INF = 0x3f3f3f3f;
const LL mod = 1000000007;
const int N = 55;
int n, m, k;
int w[N][N];
bool check(int sx, int sy)
{
if (sx >= 1 && sx <= n && sy >= 1 && sy <= m) return true;
return false;
}
LL dfs(int sx, int sy, vector<int> &t)
{
if (sx == n && sy == m)
{
if (t.size() == k) return 1;
else return 0;
}
LL res = 0;
int x = sx + 1, y = sy;
if (check(x, y))
{
bool flag = true;
for (int i = 0; i < t.size(); i ++)
if (t[i] >= w[x][y]) flag = false;
if (flag)
{
t.push_back(w[x][y]);
res = (res + dfs(x, y, t)) % mod;
t.pop_back();
}
res = (res + dfs(x, y, t)) % mod;
}
x = sx, y = sy + 1;
if (check(x, y))
{
bool flag = true;
for (int i = 0; i < t.size(); i ++)
if (t[i] >= w[x][y]) flag = false;
if (flag)
{
t.push_back(w[x][y]);
res = (res + dfs(x, y, t)) % mod;
t.pop_back();
}
res = (res + dfs(x, y, t)) % mod;
}
return res;
}
LL ansConduct(int sx, int sy)
{
LL res = 0;
vector<int> t;
res = (res + dfs(1, 1, t)) % mod;
t.push_back(w[1][1]);
res = (res + dfs(1, 1, t)) % mod;
t.clear();
return res;
}
int main()
{
ios::sync_with_stdio(false); cin.tie(0);
cin >> n >> m >> k;
for (int i = 1; i <= n; i ++)
for (int j = 1; j <= m; j ++)
cin >> w[i][j];
cout << ansConduct(1, 1) << "\n";
return 0;
}