N, A, B = map(int, input().split()) S = str(input()) rle = [] concnt = 0 now_idx = 0 while True: if now_idx >= N - 2: if concnt >= 1: rle.append(concnt) break elif S[now_idx:(now_idx + 3)] == 'con': now_idx += 3 concnt += 1 else: now_idx += 1 if concnt >= 1: rle.append(concnt) concnt = 0 INF = -50000 dp1 = [INF for _ in range(8338)] dp2 = [INF for _ in range(8338)] dp1[0] = 0 now = 0 for i in range(len(rle)): now += rle[i] // A for j in range(now + 1): for k in range(rle[i] // A + 1): if j + k >= 8338: continue dp2[j + k] = max(dp2[j + k], dp1[j] + (rle[i] - A * k) // B) for j in range(8338): dp1[j] = dp2[j] dp2[j] = INF #print(dp1[0:5]) ans = 0 for j in range(8338): if dp1[j] >= j - 1: ans = max(ans, 2 * j - 1) if dp1[j] >= j: ans = max(ans, 2 * j) print(ans)