I,R=input,range N,A,B=map(int,I().split()) S=I()+'0' X=[] c=0 w="con" for s in S: if s==w[c%3]:c+=1 elif c//3:X,c=X+[c//3],0 D=[0]+[-1]*N L=1 for x in X: L+=x//A for i in R(L,-1,-1):D[i]=max([[-1,(x-A*j)//B+D[i-j]][D[i-j]>=0]for j in R(min(x//A,i)+1)]) print(max([[0,i+min(i,D[i])][D[i]>i-2]for i in R(L)]))