int n,m,tim;
int mp[N][N], sum[N][N];
double ave,dp[N][N][N][N][N];
inline double DP(int a,int b,int c,int d,int t){
if(dp[a][b][c][d][t]) return dp[a][b][c][d][t];
if(t == 1) return sqr((double)(sum[c][d] + sum[a-1][b-1] - sum[c][b-1] - sum[a-1][d]) - ave);
dp[a][b][c][d][t] = 0x7fffffff;
R(i,b, d - 1)
R(j,1, t - 1){
double tmp = DP(a, b, c, i, j) + DP(a, i + 1, c, d, t - j);
dp[a][b][c][d][t] = Min(dp[a][b][c][d][t], tmp);
}
R(i,a, c - 1)
R(j,1, t - 1){
double tmp = DP(a, b, i, d, j) + DP(i + 1, b, c, d, t - j);
dp[a][b][c][d][t] = Min(dp[a][b][c][d][t], tmp);
}
return dp[a][b][c][d][t];
}
int main(){
io >> n >> m >> tim;
R(i,1,n){
R(j,1,m){
io >> mp[i][j];
sum[i][j] = mp[i][j] + sum[i-1][j] + sum[i][j-1] - sum[i-1][j-1];
}
}
ave = (double)sum[n][m] / (double)tim;
printf("%.2lf", sqrt(DP(1, 1, n, m, tim) / (double)tim));
return 0;
}