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 cnt = {} for l in lst: c += l // a l %= a d += l // b l %= b cnt[l] = cnt.get(l, 0) + 1 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 = [] for k, v in cnt.items(): heappush(hq, (-k, v)) while cc > 0: k, v = heappop(hq) k *= -1 if cc > v: cc -= v k += a dd -= k // b * v k %= b heappush(hq, (-k, v)) else: v = cc cc -= v k += a dd -= k // b * v break 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)