#include using namespace std; #include using namespace atcoder; using mint=modint998244353; //1000000007; using ll=long long; using pp=pair; #define sr string #define vc vector #define fi first #define se second #define rep(i,n) for(int i=0;i<(int)n;i++) #define pb push_back #define all(v) v.begin(),v.end() #define pque priority_queue #define bpc(a) __builtin_popcount(a) int main(){ int h,w,n,m;cin>>h>>w>>n>>m; vc sl(n,vc(5)); rep(i,n)rep(j,5)cin>>sl[i][j]; vc v(h,vc(w,0)); rep(z,m){ int x,y,b,c;cin>>x>>y>>b>>c; x--;y--; int nx=x-b,ny=y-b; nx=max(nx,0); ny=max(ny,0); v[nx][ny]+=c; ny=y+b+1; if(ny=h)continue; ny=y-b; ny=max(ny,0); v[nx][ny]-=c; ny=y+b+1; if(ny(w+1,0)); rep(i,h)rep(j,w)vs[i+1][j+1]=v[i][j]; rep(i,h+1)rep(j,w)vs[i][j+1]+=vs[i][j]; rep(i,h)rep(j,w+1)vs[i+1][j]+=vs[i][j]; int ans=0; rep(i,n){ auto t=sl[i]; ll a=t[0],b=t[1],c=t[2],d=t[3],h=t[4]; a--;c--; h-=vs[b][d]-vs[a][d]-vs[b][c]+vs[a][c]; if(h>0)ans++; } cout<