import bisect def main(): import sys input = sys.stdin.read().split() n = int(input[0]) A = int(input[1]) B = int(input[2]) s = input[3] # Preprocess to find all 'con' runs runs = [] i = 0 while i <= len(s) - 3: if s[i:i+3] == 'con': count = 0 j = i while j <= len(s) - 3 and s[j:j+3] == 'con': count += 1 j += 3 runs.append(count) i = j else: i += 1 # We need to process the runs dynamically considering possible overlaps after operations # But we'll use a greedy approach with the sorted list available = sorted(runs) steps = 0 current_step = 1 # 1-based steps while True: required = A if current_step % 2 == 1 else B if not available: break # Find the smallest run >= required idx = bisect.bisect_left(available, required) if idx == len(available): break # no such run selected = available.pop(idx) remaining = selected - required if remaining > 0: bisect.insort(available, remaining) steps += 1 current_step += 1 print(steps) if __name__ == '__main__': main()