include[HTML_REMOVED]
using namespace std;
int n,m,q;
const int N = 1e3+10;
int s[N][N];
int a[N][N];//构造差分矩阵
int main()
{
cin>>n>>m>>q;
for(int i=1;i<=n;i){
for(int j=1;j<=m;j){
cin>>s[i][j];
a[i][j]=s[i][j]-s[i-1][j]-s[i][j-1]+s[i-1][j-1];
}
}
while(q–){
int x1,y1,x2,y2,c;
cin>>x1>>y1>>x2>>y2>>c;
a[x1][y1]+=c;
a[x1][y2+1]-=c;
a[x2+1][y1]-=c;
a[x2+1][y2+1]+=c;
}
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]-s[i-1][j-1]+a[i][j];//重新构造前缀和二维数组
}
}
for(int i=1;i<=n;i){
for(int j=1;j<=m;j){
cout<<s[i][j]<<” “;
}
cout<<endl;
}
return 0;
}