from heapq import * n, a, b = map(int, input().split()) S = input() S = S.replace("con", "*") lst = [] row = 0 for s in S: if s == "*": row += 1 else: if row != 0: lst.append(row) row = 0 if row != 0: lst.append(row) lst.sort() tot = sum(lst) c = 0 d = 0 C = [] for l in lst: c += l // a l %= a d += l // b l %= b C.append(-l) C.sort() def ok(x): aa = (x + 1) // 2 bb = x - aa ab = aa * a + bb * b if ab > tot: return False if c < aa: return False elif d >= bb: return True cc = c - aa dd = bb - d hq = C[:] for _ in range(cc): k = -heappop(hq) k += a dd -= k // bb k %= bb if dd <= 0: return True k %= b heappush(hq, -k) return dd <= 0 l = 0 r = n + 1 while r - l > 1: mid = (l + r) // 2 if ok(mid): l = mid else: r = mid print(l)