#include<iostream>
using namespace std;
int main() {
std::ios::sync_with_stdio(false);
int n, k, t, xl, xr, yd, yu;
cin >> n >> k >> t >> xl >> yd >> xr >> yu;
int passBy = 0, stay = 0;
while (n--) {
int passNum = 0;
bool flag1 = false, flag2 = false; //flag1标记是否经过风险区, flag2标记是否逗留
for (int i = 0; i < t; ++i) {
int x, y;
cin >> x >> y;
if (flag2) continue; //如果已经判断为逗留,不再判断
if (x >= xl && x <= xr && y >= yd && y <= yu) {
if (!flag1) {
flag1 = true;
passBy++;
}
passNum++;
if (passNum == k) { //连续K个位置经过风险区
stay++;
flag2 = true;
}
}
else{
passNum = 0;
}
}
}
cout << passBy << endl << stay << endl;
return 0;
}
07-06
432