import java.util.ArrayList;
import java.util.Scanner;
class PerSon {
long x;
long y;
public PerSon(long x, long y) {
this.x = x;
this.y = y;
}
}
public class Main {
public static void main(String[] args) {
ArrayList<PerSon> perSons = new ArrayList<PerSon>();
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int t = sc.nextInt();
int x1 = sc.nextInt();
int y1 = sc.nextInt();
int x2 = sc.nextInt();
int y2 = sc.nextInt();
int num_pass = 0, num_stop = 0;
int p = 0, q = t;
for (int i = 0; i < n; i++) {
int[] temp = new int[1000];
int r = 0;
boolean pass_flag = false, stop_flag = false;
for (int j = 0; j < t; j++) {
long lx = sc.nextLong();
long ly = sc.nextLong();
perSons.add(new PerSon(lx, ly));
}
for (int j = p; j < q; j++) {
if (((perSons.get(j).x >= x1) && (perSons.get(j).x <= x2)) && ((perSons.get(j).y >= y1) && (perSons.get(j).y <= y2)))
temp[r]++;
else
r++;
}
for (int j = 0; j < temp.length; j++) {
if (temp[j] > 0 && temp[j] < k)
pass_flag = true;
if (temp[j] >= k)
stop_flag = true;
}
if (pass_flag)
if (!stop_flag)
num_pass++;
if (stop_flag)
num_stop++;
p = p + t;
q = q + t;
}
System.out.println(num_pass + num_stop);
System.out.println(num_stop);
}
}