#include using namespace std; int main() { int H,W,N,M; cin >> H >> W >> N >> M; vectorT(N),U(N),L(N),R(N),A(N); for(int i = 0; i < N; i++) { cin >> T[i] >> U[i] >> L[i] >> R[i] >> A[i]; T[i]--; U[i]--; L[i]--; R[i]--; } vector>sum(H+1,vector(W+1)); for(int i = 0; i < M; i++) { int X,Y,B,C; cin >> X >> Y >> B >> C; X--; Y--; sum[max(0,X-B)][max(0,Y-B)] += C; sum[max(0,X-B)][min(W,Y+B+1)] -= C; sum[min(H,X+B+1)][max(0,Y-B)] -= C; sum[min(H,X+B+1)][min(W,Y+B+1)] += C; } for(int i = 0; i <= H; i++) { for(int j = 0; j < W; j++) { sum[i][j+1] += sum[i][j]; } } for(int i = 0; i <= W; i++) { for(int j = 0; j < H; j++) { sum[j+1][i] += sum[j][i]; } } for(int i = 0; i <= H; i++) { for(int j = 0; j < W; j++) { sum[i][j+1] += sum[i][j]; } } for(int i = 0; i <= W; i++) { for(int j = 0; j < H; j++) { sum[j+1][i] += sum[j][i]; } } int ans = 0; for(int i = 0; i < N; i++) { long long tmp = 0; tmp += sum[U[i]][R[i]]; if(T[i]) { tmp -= sum[T[i]-1][R[i]]; } if(L[i]) { tmp -= sum[U[i]][L[i]-1]; } if(T[i] && L[i]) { tmp += sum[T[i]-1][L[i]-1]; } if(A[i] > tmp) { ans++; } } cout << ans << endl; }