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() aa = 0 bb = 0 C = [] for l in lst: aa += l // a l %= a bb += l // b l %= b C.append(-l) def f(a, b): if a > b: return 2 * b + 1 else: return 2 * a heapify(C) ans = f(aa, bb) for i in range(aa - 1, -1, -1): c = -heappop(C) c += a bb += c // b c %= b heappush(C, -c) ans = max(ans, f(i, bb)) aa = 0 for i in range(len(C)): C[i] *= -1 aa += C[i] // a C[i] %= a C[i] *= -1 heapify(C) ans = max(ans, f(aa, bb)) for j in range(bb - 1, -1, -1): c = -heappop(C) c += b aa += c // a c %= a heappush(C, -c) ans = max(ans, f(aa, j)) bb = 0 for i in range(len(C)): C[i] *= -1 bb += C[i] // b C[i] %= b C[i] *= -1 heapify(C) ans = max(ans, f(aa, bb)) for i in range(aa - 1, -1, -1): c = -heappop(C) c += a bb += c // b c %= b heappush(C, -c) ans = max(ans, f(i, bb)) print(ans)