//#include #include //#include //#include using namespace std; //using namespace atcoder; using ll = long long; #define all(A) A.begin(),A.end() using vll = vector; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using Graph = vector>; int main() { ll N; ll A,B,C; cin>>N>>A>>B>>C; vll S(N+2); rep(i,N){ string s; cin>>s; S[i]=s.size(); } S[N]=1e8; S[N+1]=1e8; vll SN(N+3,0); rep(i,N+2){ SN[i+1]=SN[i]+S[i]; } ll an=0; rep(i,N){ auto M=lower_bound(all(SN),SN[i]+A); if(*M!=SN[i]+A)continue; auto M2=lower_bound(all(SN),SN[i]+A+B); if(*M2!=SN[i]+A+B)continue; auto M3=lower_bound(all(SN),SN[i]+A+B+C); if(*M3!=SN[i]+A+B+C)continue; an++; } cout<