#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int N,a,b,c; cin >> N >> a >> b >> c; vector A(N); rep(i,N) { string s; cin >> s; A[i] = int(s.size()); } vector S(N + 1, 0); rep(i,N) S[i + 1] += S[i] + A[i]; int ans = 0; rep(i,N) { int IA = lower_bound(S.begin(), S.end(), S[i] + a) - S.begin(); int IB = lower_bound(S.begin(), S.end(), S[IA] + b) - S.begin(); int IC = lower_bound(S.begin(), S.end(), S[IB] + c) - S.begin(); if(S[IA] - S[i] == a && S[IB] - S[IA] == b && S[IC] - S[IB] == c) ans++; } cout << ans << endl; }