N = int(input()) a,b,c = map(int,input().split()) S = list(input().split()) Ind = [] for i in range(N): s = S[i] for j in range(len(s)): if j==0: Ind.append(0) else: Ind.append(1) Ind.append(0) ans = 0 L = len(Ind) for i in range(L-a-b-c): if Ind[i]!=0:continue if Ind[i+a]==0 and Ind[i+a+b]==0 and Ind[i+a+b+c]==0: ans += 1 print(ans)