import java.io.*;
class Main {
static InputStreamReader isr = new InputStreamReader(System.in);
static BufferedReader in = new BufferedReader(isr);
static OutputStreamWriter osw = new OutputStreamWriter(System.out);
static BufferedWriter out = new BufferedWriter(osw);
static final int M = 1300, N = 130, L = 66;
static int m, n, l, t;
//使用byte节约空间
static byte[][][] g = new byte[L][M][N];
static boolean[][][] flag = new boolean[L][M][N];
static int cnt;
//往6个方向移动的技巧
static int[] mi = {-1, 0, 0, 0, 1, 0};
static int[] mj = {0, -1, 0, 0, 0, 1};
static int[] mk = {0, 0, 1, -1, 0, 0};
static boolean check(int ni, int nj, int nk) {
return ni < l && ni >= 0 && nj < m && nj >= 0 && nk < n && nk >= 0 && !flag[ni][nj][nk];
}
static int dfs(int i, int j, int k) {
flag[i][j][k] = true;
if (g[i][j][k] == 0) return 0;
int num = 1;
for (int o = 0; o < 6; o++) {
int ni = i + mi[o];
int nj = j + mj[o];
int nk = k + mk[o];
if (check(ni, nj, nk)) num += dfs(ni, nj, nk);
}
return num;
}
public static void main(String[] args) throws IOException {
String[] strs = in.readLine().split(" ");
m = Integer.parseInt(strs[0]);
n = Integer.parseInt(strs[1]);
l = Integer.parseInt(strs[2]);
t = Integer.parseInt(strs[3]);
for (int i = 0; i < l; i++) {
for (int j = 0; j < m; j++) {
strs = in.readLine().split(" ");
for (int k = 0; k < n; k++) g[i][j][k] = (byte) Integer.parseInt(strs[k]);
}
}
for (int i = 0; i < l; i++) {
for (int j = 0; j < m; j++) {
for (int k = 0; k < n; k++) {
if (flag[i][j][k]) continue;
int v = dfs(i, j, k);
if (v >= t) cnt += v;
}
}
}
out.write(cnt + "");
in.close();
isr.close();
out.flush();
out.close();
osw.close();
}
}