#include<bits/stdc++.h> using namespace std; int main(){ int n,m,k; while(cin>>n>>m>>k){ vector<vector<int>> s(n+1,vector<int>(m+1,0));vector<vector<int>> a(n+1,vector<int>(m+1,0)); for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cin>>a[i][j]; } } for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ s[i][j]=s[i-1][j]+s[i][j-1]+a[i][j]-s[i-1][j-1]; } } int sss=INT_MAX; for(int x2=1;x2<=n;x2++){ for(int y2=1;y2<=m;y2++){ { for(int x1=x2;x1<=n;x1++){ for(int y1=y2;y1<=m;y1++){ int ik=s[x1][y1]-s[x2-1][y1]-s[x1][y2-1]+s[x2-1][y2-1]; if(ik>=k) { sss=min(sss,(x1-x2+1)*(y1-y2+1)); } } } } } } if(sss==INT_MAX) cout<<-1<<endl; else cout<<sss<<endl; } return 0; }