100分
# include <iostream>
using namespace std;
int n,k,t,x1,x2,y1,y2;
int ps,pl;
int main(void) {
cin>>n>>k>>t>>x1>>y1>>x2>>y2;
while(n--) {
int a,b,cnt=0;
bool flag2=false,flag1=false;
for(int i=0; i<t; i++) {
cin>>a>>b;
if(a>=x1 && a<=x2 && b>=y1 && b<=y2)flag1=true,cnt++;
else if(cnt>=k)flag2=true;
else cnt=0;
}
if(cnt>=k || flag2)pl++;
if(flag1)ps++;
}
cout<<ps<<endl<<pl;
return 0;
}