#include <bits/stdc++.h>
#define x1 fjsdifj1
#define y1 adjasodjao
#define x2 fjsdifj
#define y2 adjasodja
using namespace std;
int a[2005], b[2005], c[2005][2005], n,m,s;
const int INF = 1e9;
int dt(int x1, int y1, int x2, int y2){
cout<<c[x2][y2]<< " "<<c[x1-1][y2]<<" "<<c[x2][y1-1]<<" "<<c[x1-1][y1-1];
return c[x2][y2]-c[x1-1][y2]-c[x2][y1-1]+c[x1-1][y1-1];
}
int check(int x1, int y1, int x2, int y2){
if (c[x2][y2]-c[x1-1][y2]-c[x2][y1-1]+c[x1-1][y1-1]>s) return 0; else return 1;
}
int isOk(int d, int r){
for (int i=1;i<=n-r+1;i++){
for (int j=1;j<=m-d+1;j++) if (check(i,j,i+r-1,j+d-1)==1) return 1;
}
return 0;
}
int kiemtra(int area){
for (int i=1;i<=sqrt(area);i++){
if (isOk((int)area/i,i)==1) return 1;
}
for (int i=1;i<=sqrt(area);i++){
if (isOk(i,(int)area/i)==1) return 1;
}
return 0;
}
int main(){
cin>>n>>m;
for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) c[i][j]=0;
for (int i=1;i<=n;i++) cin>>a[i];
for (int i=1;i<=m;i++) cin>>b[i];
for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) c[i][j]=a[i]*b[j];
for (int i=1;i<=n;i++){
for (int j=1;j<=m;j++) c[i][j]=c[i][j-1]+c[i-1][j]-c[i-1][j-1]+c[i][j];
}
cin>>s;
int l=0, r=INF, mid, res;
while (l<=r){
mid = (l+r)>>1;
if (kiemtra(mid)==1){
res=mid;
l=mid+1;
} else r=mid-1;
}
for (int i=1;i<=n;i++){
for (int j=1;j<=m;j++) cout<<c[i][j]<<" ";
cout<<endl;
}
//cout<<res;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgeDEgZmpzZGlmajEKI2RlZmluZSB5MSBhZGphc29kamFvCiNkZWZpbmUgeDIgZmpzZGlmagojZGVmaW5lIHkyIGFkamFz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