# 1490 スライムと爆弾 import numpy as np from sys import stdin readline=stdin.readline h,w,n,m=map(int,readline().split()) T=[0]*n; U=[0]*n; L=[0]*n; R=[0]*n; A=[0]*n X=[0]*m; Y=[0]*m; B=[0]*m; C=[0]*m for k in range(n): T[k],U[k],L[k],R[k],A[k]=map(int,readline().split()) for k in range(m): X[k],Y[k],B[k],C[k]=map(int,readline().split()) damageMap=np.zeros((h+1+1,w+1+1)) for k in range(m): for i in range(max(Y[k]-B[k],1),min(Y[k]+B[k],h+1)+1): for j in range(max(X[k]-B[k],1),min(X[k]+B[k],w+1)+1): damageMap[i][j]+=C[k] slimes=n for k in range(n): lp=A[k] for i in range(T[k],U[k]+1): for j in range(L[k],R[k]+1): lp-=damageMap[i][j] if lp<=0: slimes-=1 break print(slimes)