n,a,b=map(int,input().split()) s=input() c=[] for i in s: c.append(i) if len(c)>=3 and c[-3]+c[-2]+c[-1]=='con': c.pop() c.pop() c.pop() c.append('!') c.append('a') d=[] tmp=0 for i in c: if i=='!': tmp+=1 else: if tmp!=0: d.append(tmp) tmp=0 m=n//3+10 dp=[-10**9]*m dp[0]=0 mx=0 for i in d: ndp=dp.copy() tmp=0 while True: c1=tmp c2=(i-a*tmp)//b if c2<0: break for j in range(mx+1): ndp[j+c1]=max(ndp[j+c1],dp[j]+c2) tmp+=1 mx+=c1 dp=ndp ans=0 #print(dp) for i in range(1,m): if dp[i]>=i-1: ans=max(2*i-1,ans) if dp[i]>=i: ans=max(ans,2*i) print(ans)