import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int[] sums = new int[n + 1]; for (int i = 1; i <= n; i++) { sums[i] = sums[i - 1]; sums[i] += sc.next().length(); } int x = n; int y = n; int z = n; int ans = 0; for (int i = n; i >= 0 && x >= 0 && y >= 0 && z >= 0; i--) { while (z >= 0 && sums[i] - sums[z] < c) { z--; } if (z < 0 || sums[i] - sums[z] > c) { continue; } while (y >= 0 && sums[z] - sums[y] < b) { y--; } if (y < 0 || sums[z] - sums[y] > b) { continue; } while (x >= 0 && sums[y] - sums[x] < a) { x--; } if (x < 0 || sums[y] - sums[x] > a) { continue; } ans++; } System.out.println(ans); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }