#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int a[101][101],w,t,h,p,pp,x[101],y[101],tt[101],ans=0;
int main(){
	cin>>w>>h>>t>>p;
	r(i,p)cin>>x[i]>>y[i]>>tt[i];
	r(i,h)r(j,w){
		cin>>pp;
		if(!pp)a[i][j]=-1;
	}
	r(i,p)if(a[y[i]][x[i]]!=-1)a[y[i]][x[i]]++;
	r(i,h)r(j,w)if(a[i][j]>=1)ans+=a[i][j];
	cout<<ans<<endl;
}