There are $n$ consecutive seat places in a railway carriage. Each place is either empty or occupied by a passenger.

The university team for the Olympiad consists of $a$ student-programmers and $b$ student-athletes. Determine the largest number of students from all $a+b$ students, which you can put in the railway carriage so that:  no student-programmer is sitting next to the student-programmer;  and no student-athlete is sitting next to the student-athlete. 

In the other words, there should not be two consecutive (adjacent) places where two student-athletes or two student-programmers are sitting.

Consider that initially occupied seat places are occupied by jury members (who obviously are not students at all).


-----Input-----

The first line contain three integers $n$, $a$ and $b$ ($1 \le n \le 2\cdot10^{5}$, $0 \le a, b \le 2\cdot10^{5}$, $a + b > 0$) — total number of seat places in the railway carriage, the number of student-programmers and the number of student-athletes.

The second line contains a string with length $n$, consisting of characters "." and "*". The dot means that the corresponding place is empty. The asterisk means that the corresponding place is occupied by the jury member.


-----Output-----

Print the largest number of students, which you can put in the railway carriage so that no student-programmer is sitting next to a student-programmer and no student-athlete is sitting next to a student-athlete.


-----Examples-----
Input
5 1 1
*...*

Output
2

Input
6 2 3
*...*.

Output
4

Input
11 3 10
.*....**.*.

Output
7

Input
3 2 3
***

Output
0



-----Note-----

In the first example you can put all student, for example, in the following way: *.AB*

In the second example you can put four students, for example, in the following way: *BAB*B

In the third example you can put seven students, for example, in the following way: B*ABAB**A*B

The letter A means a student-programmer, and the letter B — student-athlete.

Source: codeforces | Difficulty: EASY
Tags: Greedy algorithms

Implementation

Constructive algorithms


Solutions:
(n, x, y) = map(int, input().split())
import math
s = x + y
x = max(x, y)
y = s - x
a = list(map(str, input().split('*')))
b = []
for i in a:
	if '.' in i:
		b.append(len(i))
ans = 0
for i in b:
	n = math.ceil(i / 2)
	m = math.floor(i / 2)
	l = min(n, x)
	ans += l
	x -= l
	l = min(m, y)
	ans += l
	y -= l
	s = x + y
	x = max(x, y)
	y = s - x
print(ans)


(n, a, b) = list(map(int, input().split()))
s = input()
just_placed = None
ans = 0
for i in s:
	more_a = a > b
	if i == '.':
		if just_placed == 'a':
			if b > 0:
				b -= 1
				ans += 1
				just_placed = 'b'
			else:
				just_placed = None
		elif just_placed == 'b':
			if a > 0:
				a -= 1
				ans += 1
				just_placed = 'a'
			else:
				just_placed = None
		elif more_a:
			a -= 1
			ans += 1
			just_placed = 'a'
		elif b > 0:
			b -= 1
			ans += 1
			just_placed = 'b'
		else:
			just_placed = None
	else:
		just_placed = None
print(ans)


def get_list(func=None):
	if not func:
		return input().split()
	return list(map(func, input().split()))
(n, a, b) = get_list(int)
aplusb = a + b
s = input()
edge = True
last = 'c'
for ch in s:
	if ch == '*':
		edge = True
	if ch == '.':
		if edge:
			if a < b:
				b -= 1
				last = 'b'
			else:
				a -= 1
				last = 'a'
			edge = False
		elif last == 'a':
			b -= 1
			last = 'b'
		else:
			a -= 1
			last = 'a'
print(aplusb - max(a, 0) - max(b, 0))


(n, a, b) = map(int, input().split())
aa = a
bb = b
s = ['*'] + list(input())
cnt = 0
for i in range(1, n + 1):
	if a == 0 and b == 0:
		break
	elif s[i] == '.' and s[i - 1] == '*':
		if b > a:
			b -= 1
			s[i] = 'B'
		else:
			a -= 1
			s[i] = 'A'
	elif s[i] == '.' and s[i - 1] != '*':
		if s[i - 1] == 'B':
			if a:
				a -= 1
				s[i] = 'A'
			else:
				s[i] = '*'
		elif s[i - 1] == 'A':
			if b:
				b -= 1
				s[i] = 'B'
			else:
				s[i] = '*'
n = len(s)
for i in range(n):
	if s[i] == 'A' or s[i] == 'B':
		cnt += 1
print(cnt)


inputs = input().split(' ')
(numberOfSeats, programmers, athletes) = (int(inputs[0]), int(inputs[1]), int(inputs[2]))
seats = input()
result = 0
lastSit = ''
for c in seats:
	if c == '.':
		if programmers > athletes and programmers > 0:
			if lastSit != 'p':
				programmers -= 1
				result += 1
				lastSit = 'p'
			elif athletes > 0:
				athletes -= 1
				result += 1
				lastSit = 'a'
			else:
				lastSit = ''
		elif athletes >= programmers and athletes > 0:
			if lastSit != 'a':
				athletes -= 1
				result += 1
				lastSit = 'a'
			elif programmers > 0:
				programmers -= 1
				result += 1
				lastSit = 'p'
			else:
				lastSit = ''
	else:
		lastSit = ''
print(result)


(n, a, b) = map(int, input().split())
s = input()
res = a + b
prev = ''
for i in range(len(s)):
	if s[i] == '.':
		if prev == 'a':
			prev = 'b'
			b -= 1
		elif prev == 'b':
			prev = 'a'
			a -= 1
		elif a > b:
			prev = 'a'
			a -= 1
		else:
			prev = 'b'
			b -= 1
	else:
		prev = '*'
print(res - max(0, a) - max(0, b))


(n, a, b) = list(map(int, input().split()))
s = input()
ans = 0
lp = 'a'
if s[0] == '.':
	if a > b:
		a -= 1
		lp = 'a'
	else:
		b -= 1
		lp = 'b'
	ans += 1
for i in range(1, n):
	if s[i] == '.':
		if s[i - 1] == '.':
			if lp == 'a':
				if b > 0:
					b -= 1
					ans += 1
					lp = 'b'
				else:
					lp = 'x'
			elif lp == 'b':
				if a > 0:
					a -= 1
					ans += 1
					lp = 'a'
				else:
					lp = 'x'
			elif a > b:
				a -= 1
				ans += 1
				lp = 'a'
			elif b > 0:
				ans += 1
				b -= 1
				lp = 'b'
			else:
				lp = 'x'
		elif a > b:
			a -= 1
			ans += 1
			lp = 'a'
		elif b > 0:
			ans += 1
			b -= 1
			lp = 'b'
		else:
			lp = 'x'
print(ans)


(n, a, b) = [int(c) for c in input().split()]
s = input()
m = 0
i = 0
while True:
	while i < n and s[i] == '*':
		i += 1
	if i >= n:
		break
	if a > b:
		prev = 'b'
	else:
		prev = 'a'
	while i < n and s[i] == '.' and (a > 0 or b > 0):
		if prev == 'a':
			if b > 0:
				b -= 1
				m += 1
			prev = 'b'
		else:
			if a > 0:
				a -= 1
				m += 1
			prev = 'a'
		i += 1
	if a == b == 0 or i >= n:
		break
print(m)


(n, a, b) = map(int, input().split())
s = list(input())
sum = 0
i = 0
if a >= b:
	flag = 1
	while i < n:
		if a > 0 and s[i] != '*':
			s[i] = 'a'
			a -= 1
			i += 2
		else:
			i += 1
else:
	flag = 2
	while i < n:
		if b > 0 and s[i] != '*':
			s[i] = 'b'
			b -= 1
			i += 2
		else:
			i += 1
if flag == 1:
	for i in range(n):
		if s[i] == '.' and b > 0:
			s[i] = 'b'
			b -= 1
if flag == 2:
	for i in range(n):
		if s[i] == '.' and a > 0:
			s[i] = 'a'
			a -= 1
for i in range(n):
	if s[i] == 'a' or s[i] == 'b':
		sum += 1
print(sum)


(n, aa, bb) = [int(s) for s in input().split()]
s = list(input())
ans = 0
a = aa
b = bb
for i in range(n):
	if a == 0 and b == 0:
		break
	if s[i] == '.':
		if i == 0 or s[i - 1] == '*' or s[i - 1] == '.':
			if a > 0 and a >= b:
				a -= 1
				s[i] = 'A'
				ans += 1
			elif b > 0:
				b -= 1
				s[i] = 'B'
				ans += 1
		elif s[i - 1] == 'A':
			if b > 0:
				b -= 1
				s[i] = 'B'
				ans += 1
		elif s[i - 1] == 'B':
			if a > 0:
				a -= 1
				s[i] = 'A'
				ans += 1
print(ans)


(n, a, b) = map(int, input().split(' '))
tot = a + b
lens = [len(s) for s in input().split('*')]
for l in lens:
	if a > b:
		if l % 2 == 1:
			a -= min(a, (l + 1) // 2)
		else:
			a -= min(a, l // 2)
		b -= min(b, l // 2)
	else:
		a -= min(a, l // 2)
		if l % 2 == 1:
			b -= min(b, (l + 1) // 2)
		else:
			b -= min(b, l // 2)
print(tot - a - b)


(n, a, b) = list(map(int, input().split()))
s = input()
ans = 0
(A, B) = (a, b)
cnt = 0
for i in s:
	if i == '*':
		if cnt % 2:
			if a > b:
				a -= cnt // 2 + 1
				b -= cnt // 2
			else:
				a -= cnt // 2
				b -= cnt // 2 + 1
		else:
			a -= cnt // 2
			b -= cnt // 2
		cnt = 0
	else:
		cnt += 1
if cnt % 2:
	if a > b:
		a -= cnt // 2 + 1
		b -= cnt // 2
	else:
		a -= cnt // 2
		b -= cnt // 2 + 1
else:
	a -= cnt // 2
	b -= cnt // 2
cnt = 0
if a <= 0:
	if b <= 0:
		print(A + B)
	else:
		print(A + B - b)
elif b <= 0:
	print(A - a + B)
else:
	print(A - a + B - b)


(n, a, b) = map(int, input().split())
s = input()
c = a + b
i = 0
while i < n:
	if s[i] == '.':
		if a == 0 and b == 0:
			break
		elif a == 0:
			b -= 1
			i += 1
		elif b == 0:
			a -= 1
			i += 1
		elif a > b:
			j = i
			d = 0
			while j < n and s[j] != '*' and (a > 0) and (b > 0):
				if d % 2 == 0:
					a -= 1
				else:
					b -= 1
				d += 1
				j += 1
			if j == n or s[j] == '*':
				i = j
			else:
				i = j - 1
		elif b > a:
			j = i
			d = 0
			while j < n and s[j] != '*' and (b > 0) and (a > 0):
				if d % 2 == 0:
					b -= 1
				else:
					a -= 1
				d += 1
				j += 1
			if j == n or s[j] == '*':
				i = j
			else:
				i = j - 1
		else:
			j = i
			d = 0
			while j < n and s[j] != '*' and (b > 0) and (a > 0):
				if d % 2 == 0:
					b -= 1
				else:
					a -= 1
				d += 1
				j += 1
			if j == n or s[j] == '*':
				i = j
			else:
				i = j - 1
	i += 1
print(c - a - b)


(a, b, c) = map(int, input().split())
(i, j) = (0, 0)
for x in map(len, input().split('*')):
	i += x // 2
	j += x % 2
m = min(b, i) + min(c, i)
print(m + min(b + c - m, j))


def main():
	(_, a, b) = map(int, input().split())
	s = input()
	intervals = []
	cur = 0
	for c in s:
		if c == '*' and cur:
			intervals.append(cur)
			cur = 0
		elif c != '*':
			cur += 1
	if cur:
		intervals.append(cur)
	nb_student_init = a + b
	for i in intervals:
		if a == 0 and b == 0:
			break
		elif a > b:
			max_a_in_i = min(a, (i + 1) // 2)
			a -= max_a_in_i
			max_b_in_i = min(i - max_a_in_i, b)
			b -= max_b_in_i
		else:
			max_b_in_i = min(b, (i + 1) // 2)
			b -= max_b_in_i
			max_a_in_i = min(i - max_b_in_i, a)
			a -= max_a_in_i
	print(nb_student_init - a - b)
main()


[n, a, b] = list(map(int, input().strip().split()))
s = input().strip() + '*'
l0 = 0
n1 = 0
i_prev = -1
while True:
	i_next = s.find('*', i_prev + 1)
	if i_next < 0:
		break
	l = i_next - i_prev - 1
	l0 += l // 2
	n1 += l % 2
	i_prev = i_next
c = min(a, b, l0)
res = 2 * c
a -= c
b -= c
l0 -= c
res += min(l0 + n1, a + b)
print(res)


(n, a, b) = map(int, input().split())
s = '*' + input()
t = 0
for c in s:
	if c < '.':
		if a < b:
			(a, b) = (b, a)
	else:
		if a:
			a -= 1
			t += 1
		(a, b) = (b, a)
		if a + b < 1:
			break
print(t)


(n, a, b) = map(int, input().split())
s = list(map(len, input().split('*')))
(a_, b_) = (a, b)
for i in s:
	(x, y) = (i // 2, i // 2 + i % 2)
	if a > b:
		a -= y
		b -= x
	else:
		a -= x
		b -= y
print(a_ - max(0, a) + (b_ - max(0, b)))


def main():
	(_, bot, sport) = list(map(int, input().split()))
	p = input()
	bot_sit = bot
	sport_sit = sport
	train = list(map(len, p.split('*')))
	for i in train:
		if i % 2 == 0:
			bot_sit -= i // 2
			sport_sit -= i // 2
		elif bot_sit > sport_sit:
			bot_sit -= i // 2 + 1
			sport_sit -= i // 2
		else:
			bot_sit -= i // 2
			sport_sit -= i // 2 + 1
	print(sum([bot - max(bot_sit, 0), sport - max(sport_sit, 0)]))
main()


(n, a, b) = map(int, input().split())
cnt = [a, b]
mp = input()
la = 2
for i in mp:
	if i == '.':
		pf = cnt[0] < cnt[1]
		if pf == la:
			pf ^= 1
		la = pf
		if cnt[la]:
			cnt[la] -= 1
	else:
		la = 2
print(a + b - cnt[0] - cnt[1])


(_, m, n) = map(int, input().split())
t = m + n
a = [len(s) for s in input().split('*')]
for x in a:
	m -= x // 2
	n -= x // 2
	if m > n:
		m -= x % 2
	else:
		n -= x % 2
	m = max(m, 0)
	n = max(n, 0)
print(t - (m + n))


(n, a, b) = map(int, input().split())
s = a + b
r = input()
prev = ''
for c in r:
	if c == '.':
		if prev == 'a':
			if b == 0:
				prev = ''
				continue
			b -= 1
			prev = 'b'
		elif prev == 'b':
			if a == 0:
				prev = ''
				continue
			a -= 1
			prev = 'a'
		elif a >= b and a > 0:
			prev = 'a'
			a -= 1
		elif b > a and b > 0:
			prev = 'b'
			b -= 1
	else:
		prev = ''
print(s - a - b)


(n, a, b) = map(int, input().split())
k = a + b
(a, b) = (min(a, b), max(a, b))
s = input()
q = True
for i in s:
	if i == '.':
		if q:
			if b != 0:
				b -= 1
			q = False
		else:
			if a != 0:
				a -= 1
			q = True
		if a == b == 0:
			break
	else:
		q = True if b > a else False
print(k - a - b)


(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, dgraphs, mod) = (lambda : sorted(zz()), {}, 10 ** 9 + 7)
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
(n, a, b) = zz()
l = z().split('*')
t = a + b
for i in l:
	(a, b) = sorted([a, b])
	for (j, k) in enumerate(i):
		if j % 2 == 0 and k == '.':
			b -= 1
			b = max(b, 0)
		else:
			a -= 1
			a = max(a, 0)
print(t - a - b)


(n, a, b) = [int(i) for i in input().split()]
ss = a + b
st = input()
for ez in st.split('*'):
	if a > b:
		(a, b) = (b, a)
	a -= min(a, len(ez) // 2)
	b -= min(b, len(ez) - len(ez) // 2)
print(ss - a - b)


(n, a, b) = map(int, input().split())
s = input().split('*')
su = a + b
for i in s:
	c = len(i)
	if c == 0:
		continue
	if c % 2:
		c -= 1
		if a > b:
			a -= 1
		elif a < b or b != 0:
			b -= 1
		else:
			break
	if b != 0:
		b -= min(b, c // 2)
	if a != 0:
		a -= min(a, c // 2)
print(su - a - b)


(n, a, b) = map(int, input().split())
s = []
s = list(input())
for i in range(n):
	if s[i] == '.':
		if (a > b and s[i - 1] != 'A' or s[i - 1] == 'B') and a > 0:
			s[i] = 'A'
			a -= 1
		elif (b >= a and s[i - 1] != 'B' or s[i - 1] == 'A') and b > 0:
			s[i] = 'B'
			b -= 1
sum = 0
for i in range(n):
	if s[i] == 'A' or s[i] == 'B':
		sum += 1
print(sum)


(n, a, b) = map(int, input().split())
su = 0
temp = 0
for i in map(len, input().split('*')):
	su += i // 2
	temp += i % 2
ans = min(a, su) + min(b, su)
print(ans + min(a + b - ans, temp))


def inpmap():
	return map(int, input().split())
(n, a, b) = inpmap()
arr = list(input())
s = 0 if a > b else 1
ix = [a, b]
res = 0
for i in range(n):
	if arr[i] == '.':
		if ix[s] > 0:
			ix[s] -= 1
			res += 1
		s = 1 - s
	else:
		s = 0 if ix[0] > ix[1] else 1
print(res)


import atexit
import io
import sys
import math
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def main():
	(n, a, b) = [int(x) for x in input().split()]
	s = input()
	if a < b:
		(a, b) = (b, a)
	cc = 0
	tt = 0
	for c in s:
		if c == '.':
			cc += 1
		else:
			aa = math.ceil(cc / 2)
			bb = math.floor(cc / 2)
			tt += min(aa, a) + min(bb, b)
			a = max(a - aa, 0)
			b = max(b - bb, 0)
			if a < b:
				(a, b) = (b, a)
			cc = 0
	aa = math.ceil(cc / 2)
	bb = math.floor(cc / 2)
	tt += min(aa, a) + min(bb, b)
	a = max(a - aa, 0)
	b = max(b - bb, 0)
	print(tt)

def __starting_point():
	main()
__starting_point()


(n, a, b) = map(int, input().split())
s = list(input())
ans = 0
for i in range(n):
	if s[i] == '.':
		if i == 0 or (s[i - 1] != 'a' and s[i - 1] != 'b'):
			if a > b and a > 0:
				s[i] = 'a'
				a -= 1
				ans += 1
			elif b > 0:
				s[i] = 'b'
				b -= 1
				ans += 1
		elif s[i - 1] == 'a':
			if b > 0:
				s[i] = 'b'
				b -= 1
				ans += 1
		elif s[i - 1] == 'b':
			if a > 0:
				s[i] = 'a'
				a -= 1
				ans += 1
print(ans)


from itertools import accumulate, groupby
(n, a, b) = list(map(int, input().split()))
s = list(map(lambda x: 0 if x == '.' else 1, list(input())))
s = accumulate(s)
g = [len(list(g)) - 1 if k > 0 else len(list(g)) for (k, g) in groupby(s)]
g = sorted([x for x in g if x], reverse=True)
o = a + b
(a, b) = (max(a, b), min(a, b))
for g1 in g:
	a = max(0, a - g1 // 2 - 1 * (g1 % 2))
	b = max(0, b - g1 // 2)
	(a, b) = (max(a, b), min(a, b))
	if a + b == 0:
		break
print(o - (a + b))


(n, a, b) = list(map(int, input().split()))
s = input()
temp = 0
total = a + b
for i in range(n):
	if s[i] == '*':
		temp = 0
	elif temp == -1 and a > 0:
		a -= 1
		temp = 1
	elif temp == 1 and b > 0:
		b -= 1
		temp = -1
	elif temp == 0:
		if a <= 0 and b <= 0:
			break
		if a > b:
			a -= 1
			temp = 1
		else:
			b -= 1
			temp = -1
	else:
		temp = 0
print(total - a - b)


import sys
import math
import bisect

def solve(s, x1, y1):
	n = len(s)
	A = []
	for i in range(n):
		if s[i] == '.':
			if i == 0 or s[i - 1] != '.':
				val = 1
			else:
				val += 1
			if i == n - 1 or s[i + 1] != '.':
				A.append(val)
	ans = 0
	for a in A:
		(x1, y1) = (min(x1, y1), max(x1, y1))
		(x2, y2) = (a // 2, a // 2 + a % 2)
		ans += min(x1, x2) + min(y1, y2)
		x1 -= min(x1, x2)
		y1 -= min(y1, y2)
	return ans

def main():
	(n, a, b) = map(int, input().split())
	s = input()
	ans = solve(s, a, b)
	print(ans)
main()


(n, a, b) = [int(x) for x in input().split()]
p = a + b
seats = input()
prev = '*'
for seat in seats:
	if seat == '.':
		if prev == '*':
			if b > 0 and a < b:
				b -= 1
				prev = 'b'
			elif a > 0:
				a -= 1
				prev = 'a'
			else:
				break
		elif prev == 'a':
			if b > 0:
				b -= 1
			prev = 'b'
		else:
			if a > 0:
				a -= 1
			prev = 'a'
	else:
		prev = '*'
	if a == 0 and b == 0:
		break
print(p - (a + b))


(n, a, b) = map(int, input().split())
s = t = 0
for x in map(len, input().split('*')):
	s += x // 2
	t += x % 2
m = min(a, s) + min(b, s)
print(m + min(a + b - m, t))


import math
(n, a, b) = map(int, input().strip().split(' '))
t1 = a
t2 = b
s = input()
s = list(s)
for i in range(n):
	if a == 0 and b == 0:
		break
	elif s[i] == '.':
		if i == 0 or s[i - 1] == '*':
			if a > b:
				s[i] = 'a'
				a -= 1
			else:
				s[i] = 'b'
				b -= 1
		elif s[i - 1] == 'a' and b > 0:
			s[i] = 'b'
			b -= 1
		elif s[i - 1] == 'b' and a > 0:
			s[i] = 'a'
			a -= 1
		elif s[i - 1] == '.':
			if a > 0:
				s[i] = 'a'
				a -= 1
			elif b > 0:
				s[i] = 'b'
				b -= 1
		else:
			continue
print(t1 + t2 - a - b)


(n, a, b) = [int(x) for x in input().split()]
all = a + b
s = input()
l = 0
ls = []
for c in s:
	if c == '*':
		if l != 0:
			ls.append(l)
			l = 0
	else:
		l += 1
if l != 0:
	ls.append(l)

def rem(room, a, b):
	if room % 2 == 0:
		return (a - room // 2, b - room // 2)
	if room % 2 + +1:
		if a > b:
			return (a - (room - 1) // 2 - 1, b - (room - 1) // 2)
		else:
			return (a - (room - 1) // 2, b - (room - 1) // 2 - 1)
for ll in ls:
	(a, b) = rem(ll, a, b)
if a > 0:
	all -= a
if b > 0:
	all -= b
print(int(all))


def main():
	(n, a, b) = map(int, input().split())
	ab = a + b
	for v in map(len, filter(None, input().split('*'))):
		if v & 1:
			v //= 2
			if a > b:
				a -= v + 1
				b -= v
			else:
				b -= v + 1
				a -= v
		else:
			v //= 2
			a -= v
			b -= v
	print(ab - max(a, 0) - max(b, 0))
main()


(n, a, b) = map(int, input().split())
car = list(input())
st = 0
if car[0] == '.':
	if a > b and a > 0:
		car[0] = 'p'
		a -= 1
		st += 1
	elif b > 0:
		car[0] = 'a'
		b -= 1
		st += 1
for i in range(1, n):
	if a == 0 and b == 0:
		break
	if car[i] == '.':
		if car[i - 1] == 'p' and b > 0:
			car[i] = 'a'
			b -= 1
			st += 1
		elif car[i - 1] == 'a' and a > 0:
			car[i] = 'p'
			a -= 1
			st += 1
		elif car[i - 1] == '*':
			if a > b and a > 0:
				car[i] = 'p'
				a -= 1
				st += 1
			elif b > 0:
				car[i] = 'a'
				b -= 1
				st += 1
		elif car[i - 1] == '.':
			if a > 0:
				car[i] = 'p'
				st += 1
				a -= 1
			elif b > 0:
				car[i] = 'a'
				st += 1
				b -= 1
print(st)


(a, b, c) = map(int, input().split())
n = input('')
n = n + '*'
x = 0
y = 0
z = 0
i = 0
while i < len(n):
	if n[i] == '.':
		x = x + 1
	elif n[i] == '*':
		y = y + x % 2
		z = z + x
		x = 0
	i = i + 1
k = z - y
p = 0
if k // 2 - b < 0:
	p = p + k // 2
	b = b - k // 2
else:
	p = p + b
	b = 0
if k // 2 - c < 0:
	p = p + k // 2
	c = c - k // 2
else:
	p = p + c
	c = 0
if y - b - c < 0:
	p = p + y
else:
	p = p + b + c
print(p)


def main():
	(n, a, b) = map(int, input().split())
	line = input()
	spaces = [len(e) for e in line.split('*') if e]
	(ca, cb) = (a, b)
	for e in spaces:
		if e % 2 != 0:
			if ca > cb:
				cb -= e // 2
				ca -= e - e // 2
			else:
				ca -= e // 2
				cb -= e - e // 2
		else:
			ca -= e // 2
			cb -= e // 2
	ca = max(0, ca)
	cb = max(0, cb)
	print(a - ca + b - cb)
main()


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		(n, a, b) = In()
		l = list(input())
		l.append('*')
		empty = 0
		t = a + b
		for x in range(n + 1):
			if l[x] == '*':
				if empty > 0:
					if empty & 1 == 1:
						(z, z1) = (empty // 2, empty // 2)
						z1 += 1
						if a > b:
							temp = min(a, z1)
							a -= temp
							z1 -= temp
							temp = min(b, z)
							b -= temp
							z -= temp
						else:
							temp = min(b, z1)
							b -= temp
							z1 -= temp
							temp = min(a, z)
							a -= temp
							z -= temp
					else:
						(z, z1) = (empty // 2, empty // 2)
						temp = min(a, z)
						a -= temp
						z -= temp
						temp = min(b, z1)
						b -= temp
						z1 -= temp
				empty = 0
			else:
				empty += 1
		print(t - a - b)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


(n, a, b) = map(int, input().split())
s = input()
dot = s.count('.')
ary = s.split('*')
x = a + b
for i in ary:
	y = len(i)
	if y % 2 == 1:
		if a > b:
			a -= 1
		else:
			b -= 1
		y -= 1
	a -= y // 2
	b -= y // 2
print(x - max(0, a) - max(0, b))


def main():
	(n, a, b) = list(map(int, input().split()))
	t = a + b
	s = input()
	last = -1
	for c in s:
		if c == '.':
			if last == -1:
				if a >= b and a > 0:
					last = 0
					a -= 1
				elif b >= a and b > 0:
					last = 1
					b -= 1
			elif last == 0 and b > 0:
				last = 1
				b -= 1
			elif last == 1 and a > 0:
				last = 0
				a -= 1
			else:
				last = -1
		else:
			last = -1
	print(t - a - b)
main()


(n, a, b) = list(map(int, input().split()))
s = input()
ans = 0
(a1, b1) = (a, b)
ind = 0
while ind < n and (not (a == 0 and b == 0)):
	cnt = 0
	while ind < n and s[ind] != '*':
		cnt += 1
		ind += 1
	ind += 1
	if cnt % 2 != 0:
		if a < b:
			b -= 1
			cnt -= 1
			ans += 1
		else:
			a -= 1
			cnt -= 1
			ans += 1
	if a > 0:
		ans += min(a, cnt // 2)
		a -= min(a, cnt // 2)
	if b > 0:
		ans += min(b, cnt // 2)
		b -= min(b, cnt // 2)
print(ans)


zzz = input().split(' ')
mas = list(input())
x1 = int(zzz[1])
x2 = int(zzz[2])
n1 = 0
n2 = 0
for i in range(len(mas)):
	if mas[i] != '*':
		if n1 == 0 and x1 >= x2 and (x1 > 0) or (n1 != 0 and mas[i - 1] != 1 and (x1 > 0)):
			mas[i] = 1
			x1 -= 1
			n2 += 1
		elif n1 == 0 and x2 > x1 and (x2 > 0) or (n1 != 0 and mas[i - 1] != 0 and (x2 > 0)):
			mas[i] = 0
			x2 -= 1
			n2 += 1
		n1 += 1
	else:
		n1 = 0
print(n2)


(n, s1, s2) = list(map(int, input().split()))
a = input()
p = 0
f = 0
for i in range(n):
	if a[i] == '*':
		f = 0
		continue
	if s1 == 0 and f == 2:
		f = 0
		continue
	if s2 == 0 and f == 1:
		f = 0
		continue
	if f == 0 and s1 + s2 == 0:
		continue
	if f == 2:
		s1 -= 1
		p += 1
		f = 1
	elif f == 1:
		s2 -= 1
		p += 1
		f = 2
	elif f == 0:
		if s1 > s2:
			s1 -= 1
			p += 1
			f = 1
		else:
			s2 -= 1
			p += 1
			f = 2
print(p)


(n, a, b) = map(int, input().split())
empty_seat = list(input().split('*'))
(twin, alone) = (0, 0)
for i in range(len(empty_seat)):
	twin += len(empty_seat[i]) // 2
	alone += len(empty_seat[i]) % 2
twin_seat = min(a, twin) + min(b, twin)
res = twin_seat + min(alone, a + b - twin_seat)
print(res)


def isAgreaterOrEqualsB(a, b):
	return a >= b
(n, a, b) = input().split()
n = int(n)
a = int(a)
b = int(b)
seats = input()
ans = 0
turnA = False
if isAgreaterOrEqualsB(a, b):
	turnA = True
for i in range(0, n):
	if a == 0 and b == 0:
		break
	if seats[i] == '.':
		if turnA and a != 0:
			a -= 1
			turnA = False
			ans += 1
		elif turnA and a == 0:
			turnA = False
			continue
		elif not turnA and b != 0:
			b -= 1
			turnA = True
			ans += 1
		elif not turnA and b == 0:
			turnA = True
			continue
	elif isAgreaterOrEqualsB(a, b):
		turnA = True
	else:
		turnA = False
print(ans)


(n, a, b) = map(int, input().split())
lst = list(input())
k = 0
array = []
for x in range(n):
	if lst[x] == '*':
		array.append(k)
		k = 0
	else:
		k += 1
if lst[0] == '*':
	array = array[1:]
if lst[-1] != '*':
	array.append(k)
s = a + b
for x in array:
	if max(a, b) == a:
		p = (x + 1) // 2
		a = max(a - p, 0)
		b = max(b - (x - p), 0)
	else:
		p = (x + 1) // 2
		b = max(b - p, 0)
		a = max(a - (x - p), 0)
print(s - (a + b))


def main():
	(n, a, b) = map(int, input().split())
	places = input()
	ans = 0
	prev = 0
	i = 0
	while i < n and a + b > 0:
		if places[i] == '.':
			if prev == 1:
				if b > 0:
					prev = 2
					ans += 1
					b -= 1
				else:
					prev = 0
			elif prev == 2:
				if a > 0:
					prev = 1
					ans += 1
					a -= 1
				else:
					prev = 0
			else:
				ans += 1
				if a > b:
					prev = 1
					a -= 1
				else:
					prev = 2
					b -= 1
		else:
			prev = 0
		i += 1
	print(ans)
main()


(n, a, b) = [int(i) for i in input().split()]
s = input()
k = 0
lastPlace = ''
for w in s:
	if a + b != 0:
		if w == '.':
			if a >= b and a > 0 and (lastPlace != 'a'):
				a -= 1
				k += 1
				lastPlace = 'a'
			elif b >= a and b > 0 and (lastPlace != 'b'):
				b -= 1
				k += 1
				lastPlace = 'b'
			elif a > 0 and lastPlace != 'a':
				a -= 1
				k += 1
				lastPlace = 'a'
			elif b > 0 and lastPlace != 'b':
				b -= 1
				k += 1
				lastPlace = 'b'
			else:
				lastPlace = '.'
		else:
			lastPlace = ''
	else:
		break
print(k)


(n, a, b) = list(map(int, input().strip().split()))
s = input().split('*')
rslt = 0
for segment in s:
	less = len(segment) // 2
	more = len(segment) - less
	x = 0
	y = 0
	if a > b:
		x = min(a, more)
		y = min(b, less)
	else:
		x = min(a, less)
		y = min(b, more)
	rslt += x + y
	a -= x
	b -= y
print(rslt)


(n, a, b) = list(map(int, input().split()))
s = input()
s += '*'
n += 1
m = []
i = 0
i1 = -1
while i < len(s):
	if s[i] == '*':
		if i - i1 > 1:
			m.append(i - i1 - 1)
		i1 = i
	i += 1
sm = a + b
for c in m:
	if c % 2 == 0:
		a = max(0, a - c // 2)
		b = max(0, b - c // 2)
	elif a > b:
		a = max(0, a - (c + 1) // 2)
		b = max(0, b - c // 2)
	else:
		b = max(0, b - (c + 1) // 2)
		a = max(0, a - c // 2)
print(sm - a - b)


(n, a, b) = map(int, input().split())
s = a + b
ans = 0
for t in map(len, input().split('*')):
	if a > b:
		(a, b) = (b, a)
	a -= min(a, t // 2)
	b -= min(b, t - t // 2)
print(s - a - b)


(n, a, b) = list(map(int, input().split()))
inp = input().split('*')
L = []
for i in inp:
	L.append(len(i))
out = 0
for i in L:
	c1 = i // 2
	c2 = i - c1
	if b < a:
		(a, b) = (b, a)
	if a < c1:
		out += a
		a = 0
	else:
		a -= c1
		out += c1
	if b < c2:
		out += b
		b = 0
	else:
		b -= c2
		out += c2
print(out)


import sys, math, queue
MOD = 998244353
sys.setrecursionlimit(1000000)
(n, a, b) = map(int, input().split())
s = '*' + input()
st = []
for i in range(n + 1):
	if s[i] == '*':
		if len(st) == 0 or s[i - 1] != '*':
			st.append(0)
	else:
		st[-1] += 1
ans = 0
for si in st:
	p = si // 2
	q = si - p
	if a > b:
		ans += min(a, q)
		a -= min(a, q)
		ans += min(b, p)
		b -= min(b, p)
	else:
		ans += min(b, q)
		b -= min(b, q)
		ans += min(a, p)
		a -= min(a, p)
print(ans)


import sys
data = sys.stdin.readlines()
first_line = [int(x) for x in data[0].split()]
(a, b, c) = first_line[:3]
arr = list(data[1])
result = 0
if c > b:
	(b, c) = (c, b)
for (idx, x) in enumerate(arr):
	if x == '.':
		move = False
		if idx == 0 or arr[idx - 1] == '*':
			if b >= c and b:
				arr[idx] = 1
				b = b - 1
				move = True
			elif c > b and c:
				arr[idx] = 0
				c = c - 1
				move = True
		elif arr[idx - 1] != 1 and b:
			arr[idx] = 1
			b = b - 1
			move = True
		elif arr[idx - 1] != 0 and c:
			arr[idx] = 0
			c = c - 1
			move = True
		result = result + move
print(result)


(n, a, b) = [int(i) for i in input().split()]
s = input()
(sum, cnt, v) = (a + b, 0, [])
for i in range(0, n):
	if s[i] == '.':
		cnt += 1
	else:
		if cnt != 0:
			v.append(cnt)
		cnt = 0
if cnt != 0:
	v.append(cnt)
for i in range(0, len(v)):
	if a > b:
		if v[i] % 2 == 0:
			na = v[i] // 2
			nb = v[i] // 2
		else:
			na = v[i] // 2 + 1
			nb = v[i] // 2
		if a >= na:
			if nb <= b:
				a -= na
				b -= nb
			else:
				a -= na
				b = 0
		elif nb <= b:
			b -= nb
			a = 0
		else:
			a = 0
			b = 0
	else:
		if v[i] % 2 == 0:
			na = v[i] // 2
			nb = v[i] // 2
		else:
			na = v[i] // 2
			nb = v[i] // 2 + 1
		if b >= nb:
			if na <= a:
				a -= na
				b -= nb
			else:
				b -= nb
				a = 0
		elif na <= a:
			a -= na
			b = 0
		else:
			a = 0
			b = 0
print(sum - (a + b))


(n, a, b) = map(int, input().split())
s = input()
last = ''
total = 0
for c in s:
	if c == '.':
		if not last in ['a', 'b']:
			if a >= b and a > 0:
				last = 'a'
				total += 1
				a -= 1
			elif b >= a and b > 0:
				last = 'b'
				total += 1
				b -= 1
			else:
				last = c
		elif last == 'a':
			if b > 0:
				last = 'b'
				total += 1
				b -= 1
			else:
				last = '.'
		elif a > 0:
			last = 'a'
			total += 1
			a -= 1
		else:
			last = '.'
	else:
		last = c
print(total)


def check(mark, a, b):
	if mark == -1:
		if a > b:
			return 1
		else:
			return 0
	if mark == 0:
		return 1
	if mark == 1:
		return 0
(n, a, b) = [int(n) for n in input().split()]
s = input()
count: int = 0
mark = -1
if s[0] == '.':
	count += 1
	if a > b:
		mark = 1
	else:
		mark = 0
	if mark == 1:
		a -= 1
	if mark == 0:
		b -= 1
for i in range(1, len(s)):
	if a == b == 0:
		break
	if s[i] == '.':
		mark = check(mark, a, b)
		if mark == 1:
			if a == 0:
				continue
			if a > 0:
				a -= 1
				count += 1
		if mark == 0:
			if b == 0:
				continue
			if b > 0:
				b -= 1
				count += 1
	if s[i] == '*':
		mark = -1
print(count)


R = lambda : map(int, input().split())
(n, a, b) = R()
ls = tuple(map(len, input().split('*')))
s = a + b
for t in ls:
	if t % 2:
		if a > b:
			a -= 1
		else:
			b -= 1
		t -= 1
	a -= t / 2
	b -= t / 2
print(int(s - max(0, a) - max(0, b)))


(n, a, b) = map(int, input().split())
arr = input().split('*')
count = 0
for seats in arr:
	if len(seats) % 2 == 0:
		diff_a = min(a, len(seats) // 2)
		diff_b = min(b, len(seats) // 2)
		a -= diff_a
		b -= diff_b
		count += diff_a + diff_b
	elif a > b:
		diff_a = min(a, len(seats) // 2 + 1)
		diff_b = min(b, len(seats) // 2)
		a -= diff_a
		b -= diff_b
		count += diff_a + diff_b
	else:
		diff_a = min(a, len(seats) // 2)
		diff_b = min(b, len(seats) // 2 + 1)
		a -= diff_a
		b -= diff_b
		count += diff_a + diff_b
print(count)


(acentos, prog, atlet) = map(int, input().split())
onibus = input()
anterior = 'judge'
qtd = 0
for cadeira in onibus:
	if cadeira == '*':
		anterior = 'judge'
		continue
	if anterior == 'judge' or anterior == 'empty':
		if prog > atlet:
			if prog > 0:
				prog -= 1
				anterior = 'prog'
				qtd += 1
		elif atlet > 0:
			atlet -= 1
			anterior = 'atlet'
			qtd += 1
	elif anterior == 'prog':
		if atlet > 0:
			atlet -= 1
			anterior = 'atlet'
			qtd += 1
		else:
			anterior = 'empty'
	elif prog > 0:
		prog -= 1
		anterior = 'prog'
		qtd += 1
	else:
		anterior = 'empty'
print(qtd)


input_str = input().split()
n = int(input_str[0])
a = int(input_str[1])
b = int(input_str[2])
carriage = input()
cons_empty = 0
spaces = []
for c in carriage:
	if c == '*':
		if cons_empty > 0:
			spaces.append(cons_empty)
			cons_empty = 0
	else:
		cons_empty += 1
if cons_empty > 0:
	spaces.append(cons_empty)

def count(spaces, a, b):
	total = 0
	for space in spaces:
		is_a = a > b
		for i in range(space):
			if is_a:
				if a > 0:
					a -= 1
					total += 1
			elif b > 0:
				b -= 1
				total += 1
			is_a = not is_a
		if a == 0 and b == 0:
			return total
	return total
print(count(spaces, a, b))


z = [int(s) for s in input().split()]
n = z[0]
a = z[1]
b = z[2]
st = 0
x = input()
f = []
for i in range(len(x)):
	f.append(x[i])
for i in range(len(f)):
	if i == 0 and f[i] == '.':
		if a >= b:
			f[i] = 'a'
			a -= 1
		elif a < b:
			f[i] = 'b'
			b -= 1
	elif f[i] == '.':
		if f[i - 1] == 'a':
			if b > 0:
				f[i] = 'b'
				b -= 1
		if f[i - 1] == 'b':
			if a > 0:
				f[i] = 'a'
				a -= 1
		if f[i - 1] == '*' or f[i - 1] == '.':
			if a >= b and a > 0:
				f[i] = 'a'
				a -= 1
			elif a < b and b > 0:
				f[i] = 'b'
				b -= 1
for i in range(len(f)):
	if f[i] == 'a' or f[i] == 'b':
		st += 1
print(st)


import math
(n, a, b) = map(int, input().split())
string = input().split('*')
bar = a + b
for i in string:
	if i != '':
		Sum = i.count('.')
		if Sum % 2 == 0:
			num = Sum / 2
			if a > num:
				a -= num
			else:
				a = 0
			if b > num:
				b -= num
			else:
				b = 0
		else:
			num = math.ceil(Sum / 2)
			num2 = math.floor(Sum / 2)
			if a >= b:
				if a > num:
					a -= num
				else:
					a = 0
				if b > num2:
					b -= num2
				else:
					b = 0
				if a == 0 and b == 0:
					break
				continue
			if b > a:
				if a > num2:
					a -= num2
				else:
					a = 0
				if b > num:
					b -= num
				else:
					b = 0
	if a == 0 and b == 0:
		break
print(int(bar - (a + b)))


s = input().split()
(n, a, b) = (int(s[0]), int(s[1]), int(s[2]))
s = input()
s = s.split('*')
count = 0
for x in s:
	if a == 0 and b == 0:
		break
	if x != '':
		f = a
		g = b
		k = len(x)
		if k % 2 == 0:
			t = k // 2
		else:
			t = k // 2 + 1
		if b > a:
			b -= min(b, t)
			a -= min(a, k - t)
		else:
			a -= min(a, t)
			b -= min(b, k - t)
		count += f - a + (g - b)
print(count)


(n, a, p) = [int(i) for i in input().split()]
t = a + p
g = []
e = [input()]
for i in range(n):
	g.append(e[0][i])
for i in range(n):
	if i > 0 and g[i] != '*':
		if g[i] == '.' and g[i - 1] == '*' and (a >= p) and (a > 0):
			a -= 1
			g[i] = 'a'
		elif g[i] == '.' and g[i - 1] == '*' and (p > a) and (p > 0):
			p -= 1
			g[i] = 'p'
		elif g[i] == '.' and g[i - 1] != 'p' and (p > 0):
			p -= 1
			g[i] = 'p'
		elif g[i] == '.' and g[i - 1] != 'a' and (a > 0):
			a -= 1
			g[i] = 'a'
	elif i == 0 and g[i] == '.':
		if a >= p:
			a -= 1
			g[i] = 'a'
		elif p > a:
			p -= 1
			g[i] = 'p'
print(t - (a + p))


(n, a, b) = map(int, input().split())
ab_sum = a + b
cabin = map(len, input().split('*'))
for seg in cabin:
	if a < b:
		b -= min([b, (seg + 1) // 2])
		a -= min([seg // 2, a])
	else:
		b -= min([b, seg // 2])
		a -= min([(seg + 1) // 2, a])
print(ab_sum - a - b)


(n, a, b) = map(int, input().strip().split())
s = input().strip() + '*'
tot = a + b
i = 0
start_pos = s.find('.', 0)
end_pos = s.find('*', start_pos)
while start_pos != -1:
	places = end_pos - start_pos
	m1 = (places + 1) // 2
	m2 = places // 2
	if a > b:
		a -= min(a, m1)
		b -= min(b, m2)
	else:
		a -= min(a, m2)
		b -= min(b, m1)
	start_pos = s.find('.', end_pos)
	end_pos = s.find('*', start_pos)
print(tot - (a + b))


(a, b, c) = list(map(int, input().split()))
b2 = b
c2 = c
d2 = input()
d = []
for i in range(len(d2)):
	d.append(d2[i])
k = 0
for i in range(len(d)):
	if d[i] == '.':
		if i > 0:
			if d[i - 1] == '*':
				if b < c:
					d[i] = 2
					c -= 1
				else:
					d[i] = 1
					b -= 1
			elif d[i - 1] == 1:
				d[i] = 2
				c -= 1
			else:
				d[i] = 1
				b -= 1
		elif b < c:
			d[i] = 2
			c -= 1
		else:
			d[i] = 1
			b -= 1
res = 0
if b >= 0:
	res += b2 - b
else:
	res += b2
if c >= 0:
	res += c2 - c
else:
	res += c2
print(res)


(n, a, b) = map(int, input().split())
l = list(input())
(cnt, i) = (0, 0)
if a >= b:
	prog = True
	athl = False
else:
	prog = False
	athl = True
while i < n:
	if a == 0 and b == 0:
		break
	if l[i] == '.':
		if prog and a:
			a -= 1
			cnt += 1
		if athl and b:
			b -= 1
			cnt += 1
		prog = not prog
		athl = not athl
	if l[i] == '*':
		if a >= b:
			prog = True
			athl = False
		else:
			prog = False
			athl = True
	i += 1
print(cnt)


ll = lambda : map(int, input().split())
t = lambda : int(input())
ss = lambda : input()
(n, c, d) = map(int, input().split())
(a, b) = (max(c, d), min(c, d))
c = a
d = b
for ls in map(len, input().split('*')):
	if a and ls:
		a -= min(max(1, ls // 2), a)
	if b and ls > 1:
		b -= min(max(ls // 2, 1), b)
	if ls > 1 and ls % 2:
		if a >= b and a and c:
			a -= 1
	if not a and (not b):
		break
	(a, b) = (max(a, b), min(a, b))
print(c - a + d - b)


(n, p, ath) = [int(x) for x in input().split()]
s = list(input())
a = p
b = ath
j = s.count('.')
pl = 0
for i in range(0, len(s)):
	if s[i] == '.':
		pl += 1
	elif pl > 0:
		if b > a:
			if pl & 1:
				b -= min(pl // 2 + 1, b)
				a -= min(pl // 2, a)
			else:
				b -= min(pl // 2, b)
				a -= min(pl // 2, a)
		elif pl & 1:
			b -= min(pl // 2, b)
			a -= min(pl // 2 + 1, a)
		else:
			b -= min(pl // 2, b)
			a -= min(pl // 2, a)
		pl = 0
if pl > 0:
	if b > a:
		if pl & 1:
			b -= min(pl // 2 + 1, b)
			a -= min(pl // 2, a)
		else:
			b -= min(pl // 2, b)
			a -= min(pl // 2, a)
	elif pl & 1:
		b -= min(pl // 2, b)
		a -= min(pl // 2 + 1, a)
	else:
		b -= min(pl // 2, b)
		a -= min(pl // 2, a)
print(p - a + ath - b)


(N, A, B) = map(int, input().split())
S = list(input())
cnt = 0
if S[0] == '.':
	if A > B and A > 0:
		S[0] = 'A'
		A -= 1
		cnt += 1
	elif B > 0:
		S[0] = 'B'
		B -= 1
		cnt += 1
for i in range(1, len(S)):
	if S[i] == '.':
		if S[i - 1] == '*' or S[i - 1] == '.':
			if A > B:
				S[i] = 'A'
				A -= 1
				cnt += 1
			elif B > 0:
				S[i] = 'B'
				B -= 1
				cnt += 1
		elif S[i - 1] == 'A':
			if B > 0:
				S[i] = 'B'
				B -= 1
				cnt += 1
		elif A > 0:
			S[i] = 'A'
			A -= 1
			cnt += 1
print(cnt)


(n, a, b) = map(int, input().split())
places = list(input().split('*'))
count = 0
for i in range(len(places)):
	places[i] = list(places[i])
	if len(places[i]) > 0:
		if b > a:
			(a, b) = (b, a)
		if len(places[i]) % 2 == 0:
			av1 = len(places[i]) // 2
			av2 = len(places[i]) // 2
		else:
			av1 = len(places[i]) // 2 + 1
			av2 = len(places[i]) // 2
		if av1 >= a and a != 0:
			count += a
			a = 0
		elif a > av1 and a != 0:
			count += av1
			a -= av1
		if av2 >= b and b != 0:
			count += b
			b = 0
		elif av2 < b and b != 0:
			b -= av2
			count += av2
		if a == 0 and b == 0:
			i = len(places)
print(count)


def solve(carriage, n, a, b):
	odd = 0
	total = 0
	subsum = 0
	for ch in carriage:
		if ch == '.':
			subsum += 1
		elif ch == '*':
			total += subsum
			if subsum % 2 == 1:
				odd += 1
			subsum = 0
	total += subsum
	if subsum % 2 == 1:
		odd += 1
	even = (total - odd) // 2
	ans = 0
	if a <= even:
		ans += a
		a = 0
	else:
		ans += even
		a -= even
	if b <= even:
		ans += b
		b = 0
	else:
		ans += even
		b -= even
	return ans + min(a + b, odd)

def test():
	print(solve('*...*', 5, 1, 1) == 2)
	print(solve('*...*.', 6, 2, 3) == 4)
	print(solve('.*....**.*.', 11, 3, 10) == 7)
	print(solve('***', 3, 2, 3) == 0)

def nia():
	s = input()
	while len(s) == 0:
		s = input()
	s = s.split()
	iVal = []
	for i in range(len(s)):
		iVal.append(int(s[i]))
	return iVal
n = nia()
arr = input()
print(solve(arr, n[0], n[1], n[2]))


(n, a, b) = list(map(int, input().split()))
row = sorted([_ for _ in input().split('*') if _], key=lambda x: len(x), reverse=True)
total = 0
for _ in row:
	if a == 0 and b == 0:
		break
	l = len(_)
	(odd, even) = (l // 2 + l % 2, l // 2)
	if a > b:
		da = min(odd, a)
		db = min(even, b)
		total += da + db
		a -= da
		b -= db
	else:
		da = min(even, a)
		db = min(odd, b)
		total += da + db
		a -= da
		b -= db
print(total)


(n, a, b) = map(int, input().strip().split(' '))
s = list(input())
ss = -1
cnt = 0
for i in range(n):
	if a <= 0 and b <= 0:
		break
	if s[i] == '.':
		if ss == -1:
			if a > 0 and a > b:
				a -= 1
				cnt += 1
				ss = 1
			else:
				b -= 1
				cnt += 1
				ss = 2
		elif ss == 1:
			if b == 0:
				ss = 2
			else:
				b -= 1
				cnt += 1
				ss = 2
		elif a == 0:
			ss = 1
		else:
			a -= 1
			cnt += 1
			ss = 1
	else:
		ss = -1
print(cnt)


(n, a, b) = map(int, input().split())
total = a + b
s = input()
prev_took = 'none'
for i in range(n):
	if a == 0 and b == 0:
		break
	if s[i] == '.' and prev_took == 'none':
		if a > b:
			a -= 1
			prev_took = 'a'
		else:
			b -= 1
			prev_took = 'b'
	elif s[i] == '.' and prev_took == 'a':
		if b > 0:
			b -= 1
			prev_took = 'b'
		else:
			prev_took = 'none'
	elif s[i] == '.' and prev_took == 'b':
		if a > 0:
			a -= 1
			prev_took = 'a'
		else:
			prev_took = 'none'
	elif s[i] == '*':
		prev_took = 'none'
print(total - a - b)


(n, a, b) = [int(i) for i in input().split()]
s = list(input())
c = max(a, b)
d = min(a, b)
a = c
b = d
c = 0
for i in range(n):
	if a == 0 and b == 0:
		break
	if s[i] == '*':
		pass
	elif s[i] == '.' and i == 0:
		if a > 0 and a == max(a, b):
			s[i] = 'a'
			a -= 1
			c += 1
		elif b > 0:
			s[i] = 'b'
			b -= 1
			c += 1
	elif s[i] == '.':
		if a > 0 and s[i - 1] != 'a' and (a == max(a, b)):
			s[i] = 'a'
			a -= 1
			c += 1
		elif b > 0 and s[i - 1] != 'b':
			s[i] = 'b'
			b -= 1
			c += 1
print(c)


import math as ma
from sys import exit

def li():
	return list(map(int, input().split()))

def num():
	return map(int, input().split())

def nu():
	return int(input())
(n, a, b) = num()
p = input()
x = p.split('*')
e = 0
aa = a
bb = b
st = -1
for i in range(len(x)):
	c = x[i]
	if len(c) == 0:
		continue
	else:
		for ch in range(len(c)):
			if aa > 0 and ch == 0 and (aa >= bb):
				st = 1
			elif bb > 0 and ch == 0 and (bb >= aa):
				st = 2
			if aa == 0 and bb == 0:
				break
			if st == 1:
				if ch % 2 == 0:
					if aa > 0:
						e += 1
						aa -= 1
				elif bb > 0:
					e += 1
					bb -= 1
			if st == 2:
				if ch % 2 == 1:
					if aa > 0:
						e += 1
						aa -= 1
				elif bb > 0:
					e += 1
					bb -= 1
		if aa == 0 and bb == 0:
			break
print(e)


(n, a, b) = list(map(int, input().split()))
s = input()
ans = 0
p = '*'
for i in range(n):
	if s[i] == '*':
		p = '*'
	elif a > 0 and b > 0:
		if p == '*':
			if a >= b:
				a -= 1
				ans += 1
				p = 'a'
			else:
				b -= 1
				ans += 1
				p = 'b'
		elif p == 'a':
			b -= 1
			ans += 1
			p = 'b'
		else:
			a -= 1
			ans += 1
			p = 'a'
	elif a > 0:
		if p != 'a':
			a -= 1
			ans += 1
			p = 'a'
		else:
			p = '*'
	elif b > 0:
		if p != 'b':
			b -= 1
			ans += 1
			p = 'b'
		else:
			p = '*'
	else:
		print(ans)
		exit()
print(ans)
exit()


(n, a, b) = map(int, input().split())
s = list(map(lambda x: x == '.', input()))
x = a + b
for i in range(n):
	if not s[i]:
		continue
	m = max(a, b)
	if i == 0:
		if a == m and a:
			s[i] = 0
			a -= 1
		elif b == m and b:
			s[i] = 1
			b -= 1
	elif type(s[i - 1]) == bool:
		if a == m and a:
			s[i] = 0
			a -= 1
		elif b == m and b:
			s[i] = 1
			b -= 1
	elif s[i - 1] == 1 and a:
		a -= 1
		s[i] = 0
	elif s[i - 1] == 0 and b:
		b -= 1
		s[i] = 1
print(x - a - b)


(n, a, b) = map(int, input().split())
string = input().strip()
arr = string.split('*')
len_ = [len(i) for i in arr]
total = a + b
for nums in len_:
	temp1 = nums >> 1
	temp2 = nums - temp1
	if a <= b:
		a -= temp1
		b -= temp2
	else:
		a -= temp2
		b -= temp1
a = max(0, a)
b = max(0, b)
print(total - a - b)


import math
(amount, prog, sport) = [int(s) for s in input().split()]
string = input()
array = []
counter = 0
for i in range(len(string)):
	if string[i] != '*':
		counter += 1
		if i == len(string) - 1:
			array.append(counter)
	elif string[i] == '*' and counter:
		array.append(counter)
		counter = 0
sum_ = 0
for i in range(len(array)):
	if prog >= sport:
		sum_ += min(math.ceil(array[i] / 2), prog) + min(math.floor(array[i] / 2), sport)
		prog -= min(math.ceil(array[i] / 2), prog)
		sport -= min(math.floor(array[i] / 2), sport)
	else:
		sum_ += min(math.ceil(array[i] / 2), sport) + min(math.floor(array[i] / 2), prog)
		sport -= min(math.ceil(array[i] / 2), sport)
		prog -= min(math.floor(array[i] / 2), prog)
print(sum_)


(n, a, b) = map(int, input().split())
s = a + b
for t in map(len, input().split('*')):
	if b > a:
		(a, b) = (b, a)
	if t % 2:
		a -= 1
	t //= 2
	a -= t
	b -= t
print(s - max(0, a) - max(0, b))


(n, a, b) = list(map(int, input().strip().split(' ')))
arr = list(input().strip())
if a >= b:
	more = a
	less = b
else:
	more = b
	less = a
c = 0
a = more
b = less
newarr = arr
if arr[0] == '.':
	newarr[0] = 'a'
	c += 1
	a -= 1
for i in range(1, n):
	if a < 1:
		break
	if arr[i] == '.' and newarr[i - 1] != 'a':
		c += 1
		newarr[i] = 'a'
		a -= 1
for i in range(n):
	if b < 1:
		break
	if newarr[i] == '.':
		c += 1
		newarr[i] = 'b'
		b -= 1
print(c)


def fill(sarr, n, a, b):
	res = 0
	for i in range(n - 2, -1, -1):
		if sarr[i] == '.' and (a > 0 or b > 0):
			if sarr[i + 1] == '*':
				if a > b:
					a -= 1
					sarr[i] = 'A'
				else:
					b -= 1
					sarr[i] = 'B'
				res += 1
			elif sarr[i + 1] == 'A':
				if b > 0:
					res += 1
					b -= 1
					sarr[i] = 'B'
			elif sarr[i + 1] == 'B':
				if a > 0:
					res += 1
					a -= 1
					sarr[i] = 'A'
			elif a > b:
				a -= 1
				res += 1
				sarr[i] = 'A'
			else:
				b -= 1
				res += 1
				sarr[i] = 'B'
	return res
(n, a, b) = [int(i) for i in input().split()]
s = list(input())
dot = 0
ans = 0
if s[-1] == '.':
	if a > b:
		s[-1] = 'A'
		a -= 1
		ans = 1
	else:
		s[-1] = 'B'
		b -= 1
		ans = 1
ans = ans + fill(s, n, a, b)
print(ans)


import math
(n, a, b) = [int(n) for n in input().split()]
s = input()
c = a
d = b
arr = []
l = 0
for i in range(n):
	if s[i] == '.':
		l = l + 1
	if s[i] == '*':
		if l > 0:
			arr.append(l)
			l = 0
if l > 0:
	arr.append(l)
for j in arr:
	if j % 2 == 0:
		c = c - min(j // 2, c)
		d = d - min(j // 2, d)
	elif c > d:
		c = c - min((j + 1) // 2, c)
		d = d - min(j // 2, d)
	else:
		d = d - min((j + 1) // 2, d)
		c = c - min(j // 2, c)
print(a + b - (c + d))


(n, a, b) = map(int, input().split())
s = input()
ss = ''
count = 0
if s[0] != '*':
	if a >= b and a > 0:
		a -= 1
		count += 1
		ss += 'a'
	elif b > 0:
		b -= 1
		count += 1
		ss += 'b'
else:
	ss += '*'
for i in range(1, n):
	if s[i] == '*':
		ss += s[i]
	elif a > 0 and a >= b and (ss[i - 1] != 'a'):
		a -= 1
		count += 1
		ss += 'a'
	elif b > 0 and ss[i - 1] != 'b':
		b -= 1
		count += 1
		ss += 'b'
	elif a > 0 and ss[i - 1] != 'a':
		a -= 1
		count += 1
		ss += 'a'
	else:
		ss += '.'
	if a + b == 0:
		break
print(count)


(n, a, b) = map(int, input().split())
(s, ans, flag, cur) = (input(), 0, 1, 0)
for (i, j) in enumerate(s):
	if j == '.':
		if flag:
			cur = 0 if a >= b else 1
			flag = 0
		if cur and b:
			ans += 1
			b -= 1
		elif cur == 0 and a:
			ans += 1
			a -= 1
		cur ^= 1
	else:
		flag = 1
print(ans)


def main():
	(n, a, b) = map(int, input().split())
	s = input().split('*')
	ans = 0
	for i in range(len(s)):
		leng = len(s[i])
		if leng > 1:
			val_a = min(a, leng // 2 + (leng % 2 if a > b else 0))
			val_b = min(b, leng // 2 + (leng % 2 if a <= b else 0))
			a -= val_a
			b -= val_b
			ans += val_a + val_b
			if a + b == 0:
				print(ans)
				exit()
	print(ans + min(s.count('.'), a + b))
main()


(n, a, b) = [int(i) for i in input().split()]
s = input()
ans = 0
last = -1
for i in range(n):
	if a == 0 and b == 0:
		break
	if s[i] == '.':
		if i == 0 or s[i - 1] == '*' or last == -1:
			if a > b:
				ans += 1
				a -= 1
				last = 1
			else:
				ans += 1
				b -= 1
				last = 2
		elif last == 1:
			if b > 0:
				ans += 1
				b -= 1
				last = 2
			else:
				last = -1
		elif a > 0:
			ans += 1
			a -= 1
			last = 1
		else:
			last = -1
print(ans)


(n, a, b) = map(int, input().split())
s = input()
f = [0] * (n + 2)
for i in range(len(s)):
	if s[i] == '.' and (a > 0 or b > 0):
		if a > b:
			if f[i] == 0 and a != 0:
				f[i + 1] = 1
				a -= 1
			elif f[i] == 1 and b != 0:
				f[i + 1] = 2
				b -= 1
			elif f[i] == 2 and a != 0:
				f[i + 1] = 1
				a -= 1
		elif a <= b:
			if f[i] == 0 and b != 0:
				f[i + 1] = 2
				b -= 1
			elif f[i] == 1 and b != 0:
				f[i + 1] = 2
				b -= 1
			elif f[i] == 2 and a != 0:
				f[i + 1] = 1
				a -= 1
print(f.count(2) + f.count(1))


def Slove():
	(n, a, b) = map(int, input().split())
	ept = []
	for i in map(len, input().split('*')):
		if i > 0:
			ept.append(i)
	s = a + b
	for x in ept:
		if a < b:
			(a, b) = (b, a)
		b -= min(b, x // 2)
		a -= min(a, x - x // 2)
	return s - (a + b)
print(Slove())


(n, v, t) = input().split()
n = int(n)
a = int(v)
b = int(t)
s = [len(k) for k in input().split('*')]
(a, b) = (max(a, b), min(a, b))
for i in range(len(s)):
	a -= (s[i] + 1) // 2
	b -= s[i] // 2
	if a < 0:
		(a, b) = (0, 0)
		break
	elif b < 0:
		b = 0
	(a, b) = (max(a, b), min(a, b))
print(int(v) + int(t) - a - b)


import sys

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def S():
	return input()

def solve(n, a, b, lst):
	ret = 0
	for i in lst:
		if i % 2 == 0:
			cnt = min(a, i // 2)
			ret += cnt
			a -= cnt
			cnt = min(b, i // 2)
			ret += cnt
			b -= cnt
		elif a > b:
			cnt = min(a, i // 2 + 1)
			ret += cnt
			a -= cnt
			cnt = min(b, i // 2)
			ret += cnt
			b -= cnt
		elif b >= a:
			cnt = min(a, i // 2)
			ret += cnt
			a -= cnt
			cnt = min(b, i // 2 + 1)
			ret += cnt
			b -= cnt
	return ret

def main():
	(n, a, b) = LI()
	lst = S()
	print(solve(n, a, b, sorted(map(len, filter(lambda x: len(x) > 0, lst.split('*'))), reverse=True)))
main()


(n, a, b) = map(int, input().strip().split())
r = input()
l = []
count = 0
for j in r:
	if j == '.':
		count = count + 1
	else:
		if count != 0:
			l.append(count)
		count = 0
l.append(count)
ans = 0
length = len(l)
small = min(a, b)
big = max(a, b)
for i in range(length):
	k = l[i]
	t = small
	small = min(small, big)
	big = max(t, big)
	if k % 2 == 0:
		bigr = int(k // 2)
		smallr = int(k // 2)
	else:
		bigr = int(k // 2 + 1)
		smallr = int(k // 2)
	if smallr < small:
		ans = ans + smallr
		small = small - smallr
	else:
		ans = ans + small
		small = 0
	if bigr < big:
		ans = ans + bigr
		big = big - bigr
	else:
		ans = ans + big
		big = 0
print(int(ans))


import logging
fmt = '%(levelname)s - %(name)s (line:%(lineno)s) - %(message)s'
formatter = logging.Formatter(fmt)
ch = logging.StreamHandler()
ch.setLevel(logging.ERROR)
ch.setFormatter(formatter)
logger = logging.getLogger('students_in_railway_carriage')
logger.setLevel(logging.ERROR)
logger.addHandler(ch)

def solve(a, b, s):
	if a < b:
		(a, b) = (b, a)
	count = 0
	ok = True
	for (i, c) in enumerate(s):
		if c == '*':
			logger.debug('Skipping *')
			if a < b:
				(a, b) = (b, a)
			ok = True
			continue
		if a > 0 and ok:
			logger.debug(f'Substracting from a originally, a={a}, b={b}')
			count += 1
			a -= 1
			if b == 0:
				ok = False
			else:
				(a, b) = (b, a)
				ok = True
		elif a > 0 and (not ok):
			ok = True
			continue
		if a == 0 and b == 0:
			logger.debug(f'Not a and b: {a} {b}')
			break
	return count

def main():
	(_, a, b) = map(int, input().strip().split())
	s = input().strip()
	result = solve(a, b, s)
	print(result)
main()


(n, a, b) = map(int, input().split())
s = input()
ans = 0
prog = a
ath = b
o = list(map(len, s.split('*')))
for i in o:
	if i % 2 == 0:
		prog -= i // 2
		ath -= i // 2
	elif prog > ath:
		prog -= i // 2 + 1
		ath -= i // 2
	else:
		prog -= i // 2
		ath -= i // 2 + 1
print(a - max(prog, 0) + b - max(ath, 0))


(n, a, b) = map(int, input().split())
s = input()
s = list(s)
c = 0
a2 = a
b2 = b
a = max(a2, b2)
b = min(a2, b2)
i = 0
last = 0
l = []
l.append(0)
for i in range(0, n):
	if s[i] == '*':
		l.append(i)
l.append(n)
for i in range(1, len(l)):
	if i == 1:
		z = l[i] - l[i - 1]
	else:
		z = l[i] - l[i - 1] - 1
	if z % 2 == 0:
		c = c + min(a, z // 2)
		c = c + min(b, z // 2)
		a = a - min(a, z // 2)
		b = b - min(b, z // 2)
	else:
		x = (z + 1) // 2
		y = z // 2
		if a > b:
			c = c + min(a, x)
			c = c + min(b, y)
			a = a - min(a, x)
			b = b - min(b, y)
		else:
			c = c + min(a, y)
			c = c + min(b, x)
			a = a - min(a, y)
			b = b - min(b, x)
print(c)


import re
R = lambda : list(map(int, input().split()))
(n, a, b) = R()
s = input()
s0 = a + b
for t in re.findall('\\.+', s):
	t = len(t)
	if t % 2:
		if a > b:
			a -= 1
		else:
			b -= 1
		t -= 1
	a -= t / 2
	b -= t / 2
print(int(s0 - max(0, a) - max(0, b)))


(n, a, b) = map(int, input().split())
s = list(input())
ans = 0
prv = '*'
for i in range(n):
	if s[i] == '.':
		if prv == 'A' and 0 < b:
			prv = 'B'
			b -= 1
			ans += 1
		elif prv == 'B' and 0 < a:
			prv = 'A'
			a -= 1
			ans += 1
		elif prv != 'B' and a <= b and (0 < b):
			prv = 'B'
			b -= 1
			ans += 1
		elif prv != 'A' and b <= a and (0 < a):
			prv = 'A'
			a -= 1
			ans += 1
		else:
			prv = '.'
	else:
		prv = '*'
print(ans)


t = input().split(' ')
n = int(t[0])
a = int(t[1])
b = int(t[2])
s = input()
L = [0] * len(s)
for i in range(len(s)):
	if s[i] == '.':
		L[i] = 1
M = [0] + L + [0]
c = True
d = False
tot = 0
for j in range(1, len(s) + 1):
	if M[j] == 1 and M[j - 1] != 2 and (a > 0):
		c = True
	else:
		c = False
	if M[j] == 1 and M[j - 1] != 3 and (b > 0):
		d = True
	else:
		d = False
	if c and d:
		if a > b:
			d = False
		else:
			c = False
	if c and (not d):
		M[j] = 2
		a -= 1
		tot += 1
	if d and (not c):
		M[j] = 3
		b -= 1
		tot += 1
print(tot)


(n, a, b) = map(int, input().split())
ai = input()
cons_row = 0
free_places = 0
par_places = 0
temp = 0
for i in range(n):
	if ai[i] == '*':
		if cons_row < 2:
			free_places += cons_row
		elif cons_row % 2 == 0:
			par_places += cons_row // 2
		else:
			temp += 1
			par_places += cons_row // 2
		cons_row = 0
	else:
		cons_row += 1
if cons_row < 2:
	free_places += cons_row
elif cons_row % 2 == 0:
	par_places += cons_row // 2
else:
	temp += 1
	par_places += cons_row // 2
difference = temp + free_places
temp2 = temp + free_places + par_places * 2
temp3 = min(a, b) * 2 + difference
if temp2 > temp3:
	print(min(a + b, temp3 + (temp2 - temp3) // 2))
else:
	print(min(a + b, temp2))


R = lambda : list(map(int, input().split()))
(n, a, b) = R()
s = list(map(len, input().split('*')))
(sa, sb) = (a, b)
for i in s:
	if i == 0:
		continue
	x = (i + 1) // 2
	y = i - x
	if a < b:
		(a, b) = (b, a)
	a -= x
	b -= y
print(sa - max(0, a) + sb - max(0, b))


def m(a, b):
	if a > b:
		return (a, b)
	return (b, a)

def main():
	(n, a, b) = map(int, input().split())
	arr = input().split('*')
	total = 0
	for i in arr:
		if not i:
			continue
		(a, b) = m(a, b)
		if len(i) % 2:
			total += min(a, len(i) // 2 + 1) + min(b, len(i) // 2)
			a -= min(a, len(i) // 2 + 1)
			b -= min(b, len(i) // 2)
		else:
			total += min(a, len(i) // 2) + min(b, len(i) // 2)
			a -= min(a, len(i) // 2)
			b -= min(b, len(i) // 2)
	print(total)
main()


from math import ceil
from math import floor
while True:
	inp = input().split()
	n = int(inp[0])
	a = int(inp[1])
	b = int(inp[2])
	components = input().split('*')
	max_students = 0
	for c in components:
		max_a_b = min(len(c) // 2 + len(c) % 2, max(a, b))
		min_a_b = min(len(c) // 2, min(a, b))
		max_students += max_a_b + min_a_b
		if a >= b:
			a -= max_a_b
			b -= min_a_b
		else:
			a -= min_a_b
			b -= max_a_b
	print(max_students)
	break


(n, a, b) = [int(x) for x in input().split()]
(a, b) = sorted([a, b])
total = a + b
from itertools import groupby
s = input().strip()
for (val, g) in groupby(s):
	if val == '*':
		continue
	length = len(list(g))
	b -= (length + 1) // 2
	a -= length // 2
	if a > b:
		(a, b) = (b, a)
a = max(a, 0)
b = max(b, 0)
print(total - a - b)


(n, mx, mn) = map(int, input().split())
a = list(input().split('*'))
ans = 0
for i in a:
	if mx == 0 and mn == 0:
		break
	if mx < mn:
		(mx, mn) = (mn, mx)
	tmpmx = min((len(i) + 1) // 2, mx)
	tmpmn = min(len(i) // 2, mn)
	ans += tmpmx
	mx -= tmpmx
	ans += tmpmn
	mn -= tmpmn
print(ans)


(n, a, b) = map(int, input().split())
l = []
s = a + b
ch = input()
c = 0
for i in range(n):
	if ch[i] == '.':
		c += 1
	if ch[i] == '.' and i == n - 1 or ch[i] != '.':
		l.append(c)
		c = 0
l.sort()
l.reverse()
i = 0
le = len(l)
while i < le and a + b > 0:
	if l[i] % 2 == 0:
		a = max(a - l[i] // 2, 0)
		b = max(b - l[i] // 2, 0)
	elif a > b:
		a = max(a - 1 - l[i] // 2, 0)
		b = max(b - l[i] // 2, 0)
	else:
		a = max(a - l[i] // 2, 0)
		b = max(b - 1 - l[i] // 2, 0)
	i += 1
print(s - a - b)


(n, a, b) = list(map(int, input().split()))
z = list(input())
z.append('*')
s = 0
k = 0
for i in range(len(z)):
	if z[i] == '.':
		k += 1
	elif k > 0:
		if (a > 0 or b > 0) and k % 2 == 0:
			for j in range(k // 2):
				if a > 0:
					s += 1
					a -= 1
				if b > 0:
					s += 1
					b -= 1
		elif a > 0 or b > 0:
			if a > 0 and a >= b:
				for j in range(k // 2):
					if a > 0:
						s += 1
						a -= 1
					if b > 0:
						s += 1
						b -= 1
				if a > 0:
					s += 1
					a -= 1
			elif b > 0:
				for j in range(k // 2):
					if b > 0:
						s += 1
						b -= 1
					if a > 0:
						s += 1
						a -= 1
				if b > 0:
					s += 1
					b -= 1
		k = 0
print(s)


(n, a, b) = map(int, input().split())
string = input()
pos = [0] * n
for i in range(n):
	if string[i] == '*':
		pos[i] = -1
pos.insert(0, -1)
tmp = a + b
for i in range(1, n + 1):
	if a + b == 0:
		break
	if pos[i] == 0:
		if pos[i - 1] <= 0:
			if a > b:
				a -= 1
				pos[i] = 1
			elif b > 0:
				b -= 1
				pos[i] = 2
		elif pos[i - 1] == 1 and b > 0:
			b -= 1
			pos[i] = 2
		elif pos[i - 1] == 2 and a > 0:
			a -= 1
			pos[i] = 1
print(tmp - a - b)


(n, a, b) = map(int, input().split())
t = a + b
for x in map(len, input().split('*')):
	if a < b:
		(a, b) = (b, a)
	b -= min(b, x // 2)
	a -= min(a, x - x // 2)
print(t - a - b)


(n, x, y) = map(int, input().split())
a = list(map(len, input().split('*')))
t = x + y
for i in a:
	if x > y:
		(x, y) = (y, x)
	x -= min(i // 2, x)
	y -= min(i - i // 2, y)
print(t - x - y)


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from itertools import *
(n, a, b) = f()
s = si()
l = []
st = 0
for (i, j) in groupby(s):
	if i == '.':
		l.append(len(list(j)))
for i in l:
	(a, b) = (max(a, b), min(a, b))
	if a > 0 or b > 0:
		if i & 1:
			st += min(a, (i + 1) // 2)
			a = max(0, a - (i + 1) // 2)
			st += min(b, i // 2)
			b = max(0, b - i // 2)
		else:
			st += min(a, i // 2)
			a = max(0, a - i // 2)
			st += min(b, i // 2)
			b = max(0, b - i // 2)
print(st)


def solve():
	(_, a, b) = [int(elm) for elm in input().strip().split()]
	strips = [len(tok) for tok in input().strip().split('*') if len(tok) > 0]
	(a_left, b_left) = (a, b)
	for s in strips:
		if s % 2 == 0:
			a_hit = b_hit = s // 2
		else:
			smaller = s // 2
			a_hit = smaller if a_left < b_left else s - smaller
			b_hit = s - a_hit
		a_left = max(0, a_left - a_hit)
		b_left = max(0, b_left - b_hit)
	print(a + b - a_left - b_left)
solve()


(n, a, b) = map(int, input().split(' '))
s = input()
l = []
l2 = []
sm = 0
l = s.split('*')
for i in range(0, len(l)):
	if len(l[i]) != 0:
		l2.append(len(l[i]))
l2.sort()
l2.reverse()
ans = 0
for i in range(0, len(l2)):
	if l2[i] % 2 == 0:
		ans += min(a, l2[i] // 2) + min(b, l2[i] // 2)
		a -= min(a, l2[i] // 2)
		b -= min(b, l2[i] // 2)
	elif a < b:
		ans += min(a, l2[i] // 2) + min(b, l2[i] // 2 + 1)
		a -= min(a, l2[i] // 2)
		b -= min(b, l2[i] // 2 + 1)
	elif b < a:
		ans += min(a, l2[i] // 2 + 1) + min(b, l2[i] // 2)
		a -= min(a, l2[i] // 2 + 1)
		b -= min(b, l2[i] // 2)
	elif 2 * a < l2[i]:
		ans += 2 * a
		a = 0
		b = 0
	else:
		ans += l2[i]
		a -= l2[i] // 2
		b -= l2[i] // 2 + 1
print(ans)


(n, a, b) = map(int, input().split())
c = [a, b]
(f, r) = (b > a, 0)
for x in input():
	if x == '.':
		if c[f] == 0:
			f ^= 1
			continue
		c[f] -= 1
		r += 1
		f ^= 1
	if x == '*':
		f = c[1] > c[0]
print(r)


def solve(n, a, b, seq):
	empty = 0
	ans = 0
	for index in range(n):
		if seq[index] == '.':
			empty += 1
		else:
			half = empty // 2
			half2 = empty - half
			if a > b:
				if a >= half2:
					a -= half2
					ans += half2
				else:
					ans += a
					a = 0
				if b >= half:
					b -= half
					ans += half
				else:
					ans += b
					b = 0
			else:
				if b >= half2:
					b -= half2
					ans += half2
				else:
					ans += b
					b = 0
				if a >= half:
					a -= half
					ans += half
				else:
					ans += a
					a = 0
			empty = 0
		if a == 0 and b == 0:
			break
	if (a > 0 or b > 0) and empty > 0:
		half = empty // 2
		half2 = empty - half
		if a > b:
			if a >= half2:
				a -= half2
				ans += half2
			else:
				ans += a
				a = 0
			if b >= half:
				b -= half
				ans += half
			else:
				ans += b
				b = 0
		else:
			if b >= half2:
				b -= half2
				ans += half2
			else:
				ans += b
				b = 0
			if a >= half:
				a -= half
				ans += half
			else:
				ans += a
				a = 0
	return ans
(n, a, b) = list(map(int, input().split()))
seq = list(input())
print(solve(n, a, b, seq))


(n, a, b) = list(map(int, input().split()))
s = input()
l = []
for i in s:
	l.append(i)
f = 0
s = 0
for i in l:
	if i == '*':
		f = 0
	elif f == 1 and b > 0:
		s += 1
		b -= 1
		f = 2
	elif f == 2 and a > 0:
		s += 1
		a -= 1
		f = 1
	elif f == 0 and a + b > 0:
		if a == max(a, b):
			a -= 1
			f = 1
		else:
			b -= 1
			f = 2
		s += 1
	else:
		f = 0
print(s)


def inp():
	l = input()
	g = list(map(int, input().split()))
	return (l, g)

def a1(l, A):
	S = sum(A)
	s = 0
	for (j, i) in enumerate(A):
		s += i
		if S / s <= 2:
			print(j + 1)
			break

def inp2():
	l = list(map(int, input().split()))
	g = list(input())
	return (l, g)

def put_max(P, S):
	v = max(P, S, key=lambda x: len(x)).pop()
	return v

def b2(dat, A):
	S = list('s' * dat[1])
	P = list('p' * dat[2])
	n = 0
	for (i, v) in enumerate(A):
		if v == '.':
			try:
				if i > 0 and A[i - 1] in ['*', '.']:
					nv = put_max(P, S)
					A[i] = nv
					n += 1
				elif i == 0:
					nv = put_max(P, S)
					A[i] = nv
					n += 1
				elif i > 0 and A[i - 1] == 's' and P:
					A[i] = P.pop()
					n += 1
				elif i > 0 and A[i - 1] == 'p' and S:
					A[i] = S.pop()
					n += 1
			except IndexError:
				return n
	return n
print(b2(*inp2()))


while True:
	try:

		def solution(n, p, a, s):
			t = 0
			frees = []
			for i in range(n):
				if s[i] == '.':
					t += 1
				else:
					if t > 0:
						frees.append(t)
					t = 0
			if t > 0:
				frees.append(t)
			t = p + a
			frees.sort(reverse=True)
			for i in range(len(frees)):
				dot = frees[i]
				l = -1
				if p > a:
					for j in range(0, dot, 2):
						if p == 0:
							break
						p -= 1
					for j in range(1, dot, 2):
						if a == 0:
							break
						a -= 1
				else:
					for j in range(0, dot, 2):
						if a == 0:
							break
						a -= 1
					for j in range(1, dot, 2):
						if p == 0:
							break
						p -= 1
			print(t - (p + a))

		def read():
			(seat, prg, ath) = map(int, input().split())
			jury = input()
			solution(seat, prg, ath, jury)
		if __name__ == '__main__':
			read()
	except EOFError:
		break


(n, p, s) = map(int, input().split())
q = input()
a = []
x = 0
for i in q:
	if i == '*' and x:
		a.append(x)
		x = 0
	elif i == '.':
		x += 1
if x:
	a.append(x)
ans = 0
lena = len(a)
for i in range(lena):
	if p > s:
		ans += min(a[i] // 2 + a[i] % 2, p)
		p -= min(a[i] // 2 + a[i] % 2, p)
		ans += min(a[i] // 2, s)
		s -= min(a[i] // 2, s)
	else:
		ans += min(a[i] // 2 + a[i] % 2, s)
		s -= min(a[i] // 2 + a[i] % 2, s)
		ans += min(a[i] // 2, p)
		p -= min(a[i] // 2, p)
print(ans)


(n, a, b) = map(int, input().split())
string = input()
avail = [a, b]
if a >= b:
	idx = 0
else:
	idx = 1
for c in string:
	if c == '.':
		if avail[idx] > 0:
			avail[idx] -= 1
		idx = 1 - idx
	elif avail[0] >= avail[1]:
		idx = 0
	else:
		idx = 1
print(a + b - sum(avail))


(n, a, b) = map(int, input().split())
t = a + b
s = input()
curr = 0
arr = []
for c in s:
	if c == '.':
		curr += 1
	else:
		arr.append(curr)
		curr = 0
if curr > 0:
	arr.append(curr)
arr.sort()
arr.reverse()
if a < b:
	(a, b) = (b, a)
for e in arr:
	if e % 2 == 1:
		b -= e // 2
		a -= e // 2 + 1
		if a < b:
			(a, b) = (b, a)
	else:
		b -= e // 2
		a -= e // 2
if b > 0:
	t -= b
if a > 0:
	t -= a
print(t)


(n, a, b) = map(int, input().split())
a = [a, b]
s = '*' + input()
t = 0
for c in s:
	if c < '.':
		i = a.index(max(a))
	else:
		if a[i]:
			a[i] -= 1
			t += 1
		i = i ^ 1
		if sum(a) < 1:
			break
print(t)


(n, a, b) = map(int, input().split())
s = input()
(d, c, ans) = ('', 0, 0)
for i in s:
	if i != '*':
		if c == 0 and max(a, b) > 0:
			c = 1 if a > b else 2
			if c == 1:
				a -= 1
			else:
				b -= 1
		elif c == 1 and b > 0:
			c = 2
			b -= 1
		elif c == 2 and a > 0:
			c = 1
			a -= 1
		else:
			c = 0
	else:
		c = 0
	if c != 0:
		ans += 1
print(ans)


def main():
	(n, a, b) = map(int, input().split())
	arr = input()
	maxseat = 0
	lst = arr.split('*')
	(a_, b_) = (a, b)
	for i in lst:
		mi = len(i) // 2
		ma = len(i) - mi
		if a > b:
			a -= ma
			b -= mi
		else:
			a -= mi
			b -= ma
	print(a_ - max(0, a) + b_ - max(0, b))
main()


(n, a, b) = map(int, input().split())
(s, c, d, e, f) = (input() + '*', [], 0, 0, 0)
for i in s:
	if i == '.':
		d += 1
	else:
		if d > 0:
			c.append(d)
			f += d
			if d & 1:
				e += 1
		d = 0
f -= e
x = min(a, f // 2)
y = min(b, f // 2)
d += x + y
a -= x
b -= y
x = min(a, e)
d += x
a -= x
e -= x
y = min(b, e)
d += y
print(d)


(n, a, b) = map(int, input().split())
seat_arrangement = '*' + input()
seat_arrangement_arr = list(seat_arrangement)
empty_places = seat_arrangement.count('.')
total_students = a + b
for (i, c) in enumerate(seat_arrangement):
	if c == '*':
		continue
	if a == 0 and b == 0:
		break
	if seat_arrangement_arr[i - 1] == '*' and b >= a:
		b -= 1
		seat_arrangement_arr[i] = 'b'
	elif seat_arrangement_arr[i - 1] == '*' and b < a:
		a -= 1
		seat_arrangement_arr[i] = 'a'
	elif seat_arrangement_arr[i - 1] in ('a', '.') and b > 0:
		b -= 1
		seat_arrangement_arr[i] = 'b'
	elif seat_arrangement_arr[i - 1] in ('b', '.') and a > 0:
		a -= 1
		seat_arrangement_arr[i] = 'a'
print(total_students - a - b)


(n, a, b) = map(int, input().split())
s = input()
ans = 0
if a > b:
	pointer = 0
else:
	pointer = 1
for i in range(len(s)):
	if s[i] == '*':
		if a > b:
			pointer = 0
		else:
			pointer = 1
	elif pointer == 0:
		if a > 0:
			ans += 1
			a -= 1
		pointer = 1
	elif pointer == 1:
		if b > 0:
			ans += 1
			b -= 1
		pointer = 0
print(ans)


read_numbers = lambda : list(map(int, input().split()))
INF = 1 << 64
((n, a, b), ans) = (read_numbers(), 0)
s = input()
(m, j) = ([a, b], 0)
for p in (len(place) for place in s.split('*') if len(place)):
	if p & 1:
		j = 0 if m[0] > m[1] else 1
	for i in range(p):
		if m[0] == m[1] == 0:
			break
		if m[j] == 0:
			j ^= 1
			if i:
				continue
		m[j] -= 1
		ans += 1
		j ^= 1
print(ans)


class CodeforcesTask962BSolution:

	def __init__(self):
		self.result = ''
		self.n_a_b = []
		self.places = ''

	def read_input(self):
		self.n_a_b = [int(x) for x in input().split(' ')]
		self.places = input()

	def process_task(self):
		placement = [len(x) for x in self.places.split('*') if len(x) > 0]
		(rema, remb) = (self.n_a_b[1], self.n_a_b[2])
		for p in placement:
			if not p % 2:
				rema -= p // 2
				remb -= p // 2
			elif rema > remb:
				rema -= p // 2 + 1
				remb -= p // 2
			else:
				rema -= p // 2
				remb -= p // 2 + 1
			(rema, remb) = (max(0, rema), max(0, remb))
		self.result = str(self.n_a_b[1] + self.n_a_b[2] - rema - remb)

	def get_result(self):
		return self.result
Solution = CodeforcesTask962BSolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


(n, a, b) = list(map(int, input().split(' ')))
s = input()
c = list()
res = 0
ss = 0
for i in range(n):
	if s[i] == '*':
		if ss != 0:
			c.append(ss)
			ss = 0
	else:
		ss += 1
if ss != 0:
	c.append(ss)
c.sort()
n = len(c)
ss1 = 0
ss2 = 0
rrr = 0
for i in range(n):
	ss1 += c[i] // 2
	ss2 += c[i] // 2
	if c[i] % 2 != 0:
		rrr += 1
(a, b) = (min(a, b), max(a, b))
rrr1 = a - ss1
if rrr1 > 0:
	if rrr >= rrr1:
		ss1 += rrr1
		ss2 += rrr - rrr1
	else:
		ss1 += rrr
else:
	ss2 += rrr
res = min(ss1, a) + min(ss2, b)
print(res)


(n, a, b) = map(int, input().strip().split())
s = input().strip()
tot = a + b
pre = 0
for i in range(n):
	if s[i] == '.':
		if pre == 0:
			if a >= b and a > 0:
				a -= 1
				pre = 1
			elif b > 0:
				b -= 1
				pre = 2
		elif pre == 1:
			if b > 0:
				b -= 1
				pre = 2
			else:
				pre = 0
		elif pre == 2:
			if a > 0:
				a -= 1
				pre = 1
			else:
				pre = 0
	else:
		pre = 0
print(tot - a - b)


from typing import Dict, List, Tuple

def input_lst() -> List[int]:
	return [int(x) for x in input().split()]

def print_out(res: List[int]):
	print(' '.join([str(x) for x in res]))

def main():
	(n, a, b) = (int(x) for x in input().split())
	s = list(input())
	places = []
	cur_place_count = 0
	for el in s:
		if el == '*':
			if cur_place_count > 0:
				places.append(cur_place_count)
			cur_place_count = 0
		else:
			cur_place_count += 1
	if cur_place_count > 0:
		places.append(cur_place_count)
	places.sort(reverse=True)
	sum_to_seat = 0
	last_place = 0
	for pl in places:
		people_to_seat_team = min(pl // 2, min(a, b))
		a -= people_to_seat_team
		b -= people_to_seat_team
		sum_to_seat += people_to_seat_team * 2
		pl -= people_to_seat_team * 2
		if pl == 1:
			if a > b:
				if a > 0:
					a -= 1
					sum_to_seat += 1
			elif b > 0:
				b -= 1
				sum_to_seat += 1
		elif a == 0:
			people_to_seat_team = min(pl // 2 + pl % 2, b)
			sum_to_seat += people_to_seat_team
			b -= people_to_seat_team
		elif b == 0:
			people_to_seat_team = min(pl // 2 + pl % 2, a)
			sum_to_seat += people_to_seat_team
			a -= people_to_seat_team
	print(sum_to_seat)
main()


(n, a, b) = list(map(int, input().split()))
(s, p) = (0, 0)
for i in map(len, input().split('*')):
	s += i // 2
	p += i % 2
ans = min(a, s) + min(b, s)
print(ans + min(p, a + b - ans))


(n, a, b) = [int(i) for i in input().split(' ')]
s = [i for i in input()]
l = []
for i in range(n):
	if s[i] == '*':
		l.append(i)
		break
j = i
while j < n - 1:
	j += 1
	if s[j] == '*':
		l.append(j - i - 1)
		i = j
if s[-1] == '.':
	j = n - 1
	ll = 0
	while s[j] != '*' and j >= 0:
		j -= 1
		ll += 1
	l.append(ll)
l.sort()
ans = 0
for p in l:
	if p % 2 == 0:
		na = min(a, p // 2)
		nb = min(b, p // 2)
		ans += na + nb
		a -= na
		b -= nb
	elif a > b:
		na = min(a, (p + 1) // 2)
		nb = min(b, p // 2)
		ans += na + nb
		a -= na
		b -= nb
	else:
		na = min(a, p // 2)
		nb = min(b, (p + 1) // 2)
		ans += na + nb
		a -= na
		b -= nb
print(ans)


(n, a, b) = map(int, input().split())
carriages = input().split('*')
students_number = 0
for carriage in carriages:
	seats_count = len(carriage)
	if seats_count % 2 == 0:
		a_students = min(a, seats_count // 2)
		b_students = min(b, seats_count // 2)
		a -= a_students
		b -= b_students
		students_number += a_students + b_students
	else:
		if a >= b:
			a_students = min(a, seats_count // 2 + 1)
			b_students = min(b, seats_count // 2)
		else:
			b_students = min(b, seats_count // 2 + 1)
			a_students = min(a, seats_count // 2)
		a -= a_students
		b -= b_students
		students_number += a_students + b_students
print(students_number)


(n, a, b) = map(int, input().split())
dnum = 0
re = 0
for i in input():
	if i == '.':
		dnum += 1
	else:
		tem = dnum // 2
		if a > b:
			re += min(dnum - tem, a) + min(tem, b)
			a = max(0, a - (dnum - tem))
			b = max(0, b - tem)
		else:
			re += min(tem, a) + min(dnum - tem, b)
			a = max(0, a - tem)
			b = max(0, b - (dnum - tem))
		dnum = 0
tem = dnum // 2
if a > b:
	re += min(dnum - tem, a) + min(tem, b)
	a = max(0, a - (dnum - tem))
	b = max(0, b - tem)
else:
	re += min(tem, a) + min(dnum - tem, b)
	a = max(0, a - tem)
	b = max(0, b - (dnum - tem))
	dnum = 0
print(re)


(n, a, b) = map(int, input().split())
d = input()
u = []
k = 0
for i in range(n):
	if d[i] == '*':
		if k != 0:
			u.append(k)
			k = 0
	else:
		k += 1
if k != 0:
	u.append(k)
	k = 0
ans = 0
for i in u:
	if a > b:
		(a, b) = (b, a)
	am = min(a, i // 2)
	bm = min(b, i - i // 2)
	ans += am + bm
	a -= am
	b -= bm
print(ans)


def main():
	(n, a, b) = (int(x) for x in input().split())
	total = a + b
	string = input().split('*')
	for i in string:
		if a > b:
			(a, b) = (b, a)
		a -= min(a, len(i) // 2)
		b -= min(b, len(i) - len(i) // 2)
	print(total - a - b)
main()


(n, a, b) = map(int, input().split())
s = input()
(res, e) = (0, '')
r = 0
for (i, x) in enumerate(s):
	if a == 0 and b == 0:
		break
	if x == '.':
		if e == '':
			if a > b:
				if b == 0:
					r = 0
					a -= 1
				else:
					a -= 1
				e = 'a'
			else:
				if a == 0:
					r = 0
					b -= 1
				else:
					b -= 1
				e = 'b'
			res += 1
		elif e == 'a':
			if b == 0:
				if r == 0:
					r = 1
				else:
					a -= 1
					r = 0
					res += 1
			else:
				b -= 1
				e = 'b'
				res += 1
		elif a == 0:
			if r == 0:
				r = 1
			else:
				b -= 1
				r = 0
				res += 1
		else:
			a -= 1
			e = 'a'
			res += 1
	else:
		e = ''
print(res)


def read_data():
	(n, k, l) = map(int, list(input().strip().split()))
	a = list(input().strip())
	return (n, k, l, a)

def solve(k, l):
	tot = 0
	last = '*'
	for ch in a:
		if k == 0 and l == 0:
			return tot
		if ch == '.':
			if last == 'k':
				if l > 0:
					l -= 1
					tot += 1
					last = 'l'
				else:
					last = '*'
			elif last == 'l':
				if k > 0:
					k -= 1
					tot += 1
					last = 'k'
				else:
					last = '*'
			elif last == '*':
				if k > l:
					k -= 1
					last = 'k'
				else:
					l -= 1
					last = 'l'
				tot += 1
		else:
			last = '*'
	return tot
(n, k, l, a) = read_data()
print(solve(k, l))


(a, b, c) = map(int, input().split())
s = 0
z = input()
i = 0
while i < a:
	if z[i] == '.' and (b > 0 or c > 0):
		k = 0
		o = i
		if b >= c:
			b -= 1
			s += 1
		else:
			c -= 1
			s += 1
			k = 1
		i += 1
		while i < a and z[i] == '.':
			if k:
				if b:
					b -= 1
					s += 1
			elif c:
				c -= 1
				s += 1
			k ^= 1
			i += 1
	else:
		i += 1
print(s)


(n, a, b) = [int(x) for x in input().split()]
car = input()
total = 0
if a > b:
	c = 0
else:
	c = 1
for i in range(len(car)):
	if car[i] == '.':
		if a > 0 and b > 0:
			if c:
				b -= 1
				c = 0
			else:
				a -= 1
				c = 1
			total += 1
		elif b > 0:
			if c:
				b -= 1
				total += 1
				c = 0
			else:
				c = 1
		elif a > 0:
			if c == 0:
				a -= 1
				total += 1
				c = 1
			else:
				c = 0
		else:
			break
	else:
		c = 0 if a > b else 1
print(total)


(n, a, b) = map(int, input().split())
s = input().split('*')
s = sorted(s, key=lambda x: len(x), reverse=True)
s = list(filter(lambda x: len(x) > 0, s))
num = 0
for i in range(len(s)):
	k = len(s[i])
	if k % 2 == 0:
		num += min(k // 2, a)
		a -= k // 2
		if a < 0:
			a = 0
		num += min(k // 2, b)
		b -= k // 2
		if b < 0:
			b = 0
	elif a >= b:
		num += min(k // 2 + 1, a)
		a -= k // 2 + 1
		if a < 0:
			a = 0
		num += min(k // 2, b)
		b -= k // 2
		if b < 0:
			b = 0
	else:
		num += min(k // 2, a)
		a -= k // 2
		if a < 0:
			a = 0
		num += min(k // 2 + 1, b)
		b -= k // 2 + 1
		if b < 0:
			b = 0
print(num)


(n, a, b) = [int(x) for x in input().split()]
state = input()
state = state.split('*')
state = [len(seq) for seq in state if seq != '']
(aa, bb) = (a, b)
for x in state:
	aa -= x // 2
	bb -= x // 2
	if x % 2 == 1:
		(aa, bb) = (aa - 1, bb) if aa > bb else (aa, bb - 1)
aa = max(aa, 0)
bb = max(bb, 0)
print(a + b - aa - bb)


(n, a, b) = map(int, input().split())
s = input()
ind = 0
mark = True
res = 0
prev = 'a'
while ind < n:
	if s[ind] == '*':
		mark = True
	elif mark:
		if a > b:
			a -= 1
			prev = 'a'
		else:
			if b == 0:
				break
			b -= 1
			prev = 'b'
		mark = False
		res += 1
	else:
		if prev == 'a':
			if b == 0:
				ind += 1
				prev = 'b'
				continue
			b -= 1
			prev = 'b'
		else:
			if a == 0:
				ind += 1
				prev = 'a'
				continue
			a -= 1
			prev = 'a'
		res += 1
	ind += 1
print(res)


import sys
import math as mt
import bisect
t = 1

def solve(n, a, b):
	x = a + b
	if a < b:
		(a, b) = (b, a)
	for i in range(len(l)):
		if l[i] % 2 == 0:
			a -= l[i] // 2
			b -= l[i] // 2
		else:
			a -= l[i] // 2 + 1
			b -= l[i] // 2
			if b > a:
				(a, b) = (b, a)
	if a > 0:
		x -= a
	if b > 0:
		x -= b
	return x
for _ in range(t):
	(n, a, b) = map(int, input().split())
	s = input()
	l = []
	cnt = 0
	for i in range(len(s)):
		if s[i] == '.':
			cnt += 1
		else:
			if cnt > 0:
				l.append(cnt)
			cnt = 0
	if cnt > 0:
		l.append(cnt)
	print(solve(n, a, b))


def main():
	(n, a, b) = map(int, input().split())
	s = list(filter(lambda x: x > 0, map(len, input().split('*'))))
	x = a + b
	for w in s:
		if a > b:
			(a, b) = (b, a)
		(ma, mb) = (w // 2, (w + 1) // 2)
		(a, b) = (max(0, a - ma), max(0, b - mb))
	print(x - a - b)
main()


from math import *
m = []
s = []
for i in range(1):
	x = list(map(int, input().split()))
	m.append(x)
	s.append(input())
flag = -1
for i in range(1):
	a = m[i][1]
	b = m[i][2]
	t = s[i]
	l = 0
	count = 0
	for j in range(m[i][0]):
		countp = count
		if a >= b:
			flag = 1
		else:
			flag = 2
		if t[j] == '.' and l == 2 and (a >= 1):
			a = a - 1
			if a >= b:
				flag = 1
			else:
				flag = 2
			count = count + 1
			l = 1
		elif t[j] == '.' and l == 1 and (b >= 1):
			b = b - 1
			if a >= b:
				flag = 1
			else:
				flag = 2
			count = count + 1
			l = 2
		elif t[j] == '.' and l == 0:
			if flag == 1 and a >= 1:
				a = a - 1
				if a >= b:
					flag = 1
				else:
					flag = 2
				count = count + 1
				l = 1
			elif flag == 2 and b >= 1:
				b = b - 1
				if a >= b:
					flag = 1
				else:
					flag = 2
				count = count + 1
				l = 2
		elif t[j] == '*':
			l = 0
		if countp == count:
			l = 0
	print(count)


(n, a, b) = map(int, input().split())
(origa, origb) = (a, b)
railcar = input()
occupied = []
for i in range(n):
	if railcar[i] == '*':
		occupied.append(i)
if len(occupied) == 0:
	if a == b:
		r = a + b
		print(min(n, r))
	else:
		if n % 2 == 0:
			u = min(max(a, b), n // 2)
		else:
			u = min(max(a, b), n // 2 + 1)
		v = min(min(a, b), n - u)
		print(min(n, v + u))
	exit()
spaces = []
if occupied[0]:
	spaces.append(occupied[0])
if n - occupied[-1] - 1:
	spaces.append(n - occupied[-1] - 1)
for i in range(1, len(occupied)):
	spaces.append(occupied[i] - occupied[i - 1] - 1)
for i in spaces:
	if i % 2 == 0:
		a -= i // 2
		b -= i // 2
	elif a > b:
		a -= i // 2 + 1
		b -= i // 2
	else:
		a -= i // 2
		b -= i // 2 + 1
res = origa - max(a, 0)
res += origb - max(b, 0)
print(res)


(n, a, b) = list(map(int, input().split()))
(s, k, kol) = (list(input()), 0, 0)
for i in s:
	if i == '.':
		if k == 0:
			if a >= b and a > 0:
				(a, kol, k) = (a - 1, kol + 1, 1)
			elif b > 0:
				(b, kol, k) = (b - 1, kol + 1, 2)
		elif k == 1 and b > 0:
			(b, kol, k) = (b - 1, kol + 1, 2)
		elif k == 2 and a > 0:
			(a, kol, k) = (a - 1, kol + 1, 1)
		else:
			k = 0
	else:
		k = 0
print(kol)


(n, a, b) = map(int, input().split())
number = 0
string = input()
s = [t for t in string]
for i in range(0, n):
	if s[i] == '.':
		if i != 0:
			if s[i - 1] == '*':
				if a > b:
					if a != 0:
						number += 1
						a -= 1
						s[i] = 'a'
					elif b != 0:
						b -= 1
						number += 1
						s[i] = 'b'
				elif b != 0:
					number += 1
					b -= 1
					s[i] = 'b'
				elif a != 0:
					number += 1
					a -= 1
					s[i] = 'a'
			else:
				if s[i - 1] == 'a':
					if b != 0:
						b -= 1
						number += 1
						s[i] = 'b'
				if s[i - 1] == 'b':
					if a != 0:
						a -= 1
						number += 1
						s[i] = 'a'
				if s[i - 1] == '.':
					if a > b:
						if a != 0:
							number += 1
							a -= 1
							s[i] = 'a'
						elif b != 0:
							number += 1
							b -= 1
							s[i] = 'b'
					elif b != 0:
						number += 1
						b -= 1
						s[i] = 'b'
					elif a != 0:
						number += 1
						a -= 1
						s[i] = 'a'
		elif a > b:
			if a != 0:
				number += 1
				a -= 1
				s[i] = 'a'
			elif b != 0:
				number += 1
				b -= 1
				s[i] = 'b'
		elif b != 0:
			number += 1
			b -= 1
			s[i] = 'b'
		elif a != 0:
			number += 1
			a -= 1
			s[i] = 'a'
	if a == 0 and b == 0:
		break
print(number)


(n, a, b) = map(int, input().split())
cnt = 0
ans = 0
for x in input():
	if x == '.':
		cnt = cnt + 1
	else:
		tmp = cnt // 2
		if a > b:
			ans = ans + min(a, cnt - tmp) + min(b, tmp)
			a = max(0, a - cnt + tmp)
			b = max(0, b - tmp)
		else:
			ans = ans + min(a, tmp) + min(b, cnt - tmp)
			a = max(0, a - tmp)
			b = max(0, b - cnt + tmp)
		cnt = 0
tmp = cnt // 2
if a > b:
	ans = ans + min(a, cnt - tmp) + min(b, tmp)
	a = max(0, a - cnt + tmp)
	b = max(0, b - tmp)
else:
	ans = ans + min(a, tmp) + min(b, cnt - tmp)
	a = max(0, a - tmp)
	b = max(0, b - cnt + tmp)
print(ans)


(n, a, b) = map(int, input().split())
l = list(map(len, input().split('*')))
(sa, sb) = (a, b)
for m in l:
	if m == 0:
		continue
	c = (m + 1) // 2
	d = m - c
	if a > b:
		a -= c
		b -= d
	else:
		a -= d
		b -= c
print(sa - max(0, a) + sb - max(0, b))


(n, a, b) = map(int, input().split())
data = str(input())
__len = 0
ans = 0
prev = -1
for el in data:
	if el == '.':
		if prev == -1:
			if a >= b and a != 0:
				prev = 0
				ans += 1
				a -= 1
			elif b >= a and b != 0:
				prev = 1
				ans += 1
				b -= 1
			continue
		if prev == 0:
			if b > 0:
				b -= 1
				ans += 1
				prev = 1
			else:
				prev = -1
			continue
		if prev == 1:
			if a > 0:
				a -= 1
				ans += 1
				prev = 0
			else:
				prev = -1
			continue
	else:
		prev = -1
print(ans)


(n, a, b) = [int(i) for i in input().split()]
pi3da = input()
sum = a + b
for xu7 in map(len, pi3da.split('*')):
	if b < a:
		(a, b) = (b, a)
	a -= min(a, xu7 // 2)
	b -= min(b, xu7 - xu7 // 2)
print(sum - a - b)


(n, a, b) = map(int, input().split())
s = input().split('*')
ans = 0
for i in range(len(s)):
	if len(s) > 0:
		p = len(s[i]) // 2
		q = len(s[i]) - p
		if a > b:
			ans += min(q, a)
			ans += min(p, b)
			a -= min(q, a)
			b -= min(p, b)
		else:
			ans += min(q, b)
			ans += min(p, a)
			b -= min(q, b)
			a -= min(p, a)
print(ans)


(n, a, b) = [int(i) for i in input().split()]
s = input()
v = [len(i) for i in s.split('*') if len(i)]
v.sort()
ans = 0
for i in v:
	if a > b:
		(a, b) = (b, a)
	if i // 2 > a:
		of = 0
		if b >= a + 1:
			of = 1
		i -= a + min(a + 1, b) + of
		ans += a + min(a + 1, b)
		b -= min(a + 1, b)
		a -= a
		ans += min(b, (i + 1) // 2)
		b -= min(b, (i + 1) // 2)
		continue
	ans += i // 2 + min(b, (i + 1) // 2)
	a -= i // 2
	b -= min(b, (i + 1) // 2)
print(ans)


(n, a, b) = map(int, input().split())
s = input()
arr = []
ct = 0
for i in range(n):
	if s[i] == '*':
		if ct != 0:
			arr.append(ct)
		ct = 0
	else:
		ct += 1
if ct != 0:
	arr.append(ct)
ans = 0
for i in range(len(arr)):
	x = (arr[i] + 1) // 2
	y = arr[i] - x
	if a > b:
		z = min(a, x)
		ans += z
		a -= z
		z = min(b, y)
		ans += z
		b -= z
	else:
		z = min(b, x)
		ans += z
		b -= z
		z = min(a, y)
		ans += z
		a -= z
print(ans)


(n, a, b) = map(int, input().split())
line = input()
previous = 'coach'
placed = 0

def place_a():
	global previous, placed, a
	previous = 'a'
	if a > 0:
		a -= 1
		placed += 1

def place_b():
	global previous, placed, b
	previous = 'b'
	if b > 0:
		b -= 1
		placed += 1
for seat in line:
	if b > 0 or a > 0:
		if seat == '*':
			previous = 'coach'
		elif previous == 'coach':
			if a > b:
				place_a()
			else:
				place_b()
		elif previous == 'a':
			place_b()
		else:
			place_a()
	else:
		break
print(placed)


(n, a, b) = map(int, input().split())
vagon = input() + '*'
(free, ans) = (0, 0)
(pr_a, pr_b) = (a, b)
for i in range(n + 1):
	if a == 0 and b == 0:
		break
	if vagon[i] == '.':
		free += 1
	else:
		if a >= b:
			(a, b) = (a - min(a, (free - 1) // 2 + 1), b - min(b, free // 2))
		else:
			(b, a) = (b - min(b, (free - 1) // 2 + 1), a - min(a, free // 2))
		ans += pr_a - a + (pr_b - b)
		(pr_a, pr_b) = (a, b)
		free = 0
print(ans)


(n, a, b) = map(int, input().split())
mesta = list(input())
ans = 0
if mesta[0] == '.':
	if a >= b and a > 0:
		mesta[0] = 'A'
		a -= 1
		ans += 1
	elif b >= a and b > 0:
		mesta[0] = 'B'
		b -= 1
		ans += 1
for i in range(1, len(mesta)):
	if mesta[i] == '.':
		if mesta[i - 1] == 'A' and b > 0:
			mesta[i] = 'B'
			ans += 1
			b -= 1
		elif mesta[i - 1] == 'B' and a > 0:
			mesta[i] = 'A'
			ans += 1
			a -= 1
		elif a == 0 and b == 0:
			break
		elif a >= b and a > 0 and (mesta[i - 1] != 'A'):
			mesta[i] = 'A'
			ans += 1
			a -= 1
		elif b >= a and b > 0 and (mesta[i - 1] != 'B'):
			mesta[i] = 'B'
			ans += 1
			b -= 1
print(ans)


(n, a, b) = input().split()
(n, a, b) = (int(n), int(a), int(b))
rc = list(map(len, input().split('*')))
kaj = a + b
for i in rc:
	if b < a:
		(b, a) = (a, b)
	a -= min(i // 2, a)
	b -= min(i - i // 2, b)
print(kaj - a - b)


from sys import stdin, stdout
from math import gcd
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007

def solve():
	(n, a, b) = mp()
	ans = 0
	s = [len(i) for i in input().split('*') if len(i)]
	x = max(a, b)
	y = min(a, b)
	for i in s:
		for j in range(i):
			if x > 0 and j % 2 == 0:
				ans += 1
				x -= 1
			if y > 0 and j % 2:
				ans += 1
				y -= 1
		(x, y) = (max(x, y), min(x, y))
	pr(ans)
for _ in range(1):
	solve()


(n, a, b) = map(int, input().split())
s = input()
ans = 0
i = 0
while i < n:
	if a < b:
		(a, b) = (b, a)
	while s[i] == '.' and i < n:
		if a > 0:
			ans += 1
		a -= 1
		(a, b) = (b, a)
		i += 1
		if i == n:
			break
	i += 1
	if i == n:
		break
print(ans)


x = input().split()
y = input()
n = int(x[0])
a = int(x[1])
b = int(x[2])
eldoor = 0
i = 0
while i < n and a + b > 0:
	if y[i] == '*':
		eldoor = 0
		i = i + 1
	elif eldoor == 1:
		if a >= 1:
			a = a - 1
			eldoor = 2
			i = i + 1
		else:
			eldoor = 2
			i = i + 1
	elif eldoor == 2:
		if b >= 1:
			b = b - 1
			eldoor = 1
			i = i + 1
		else:
			eldoor = 1
			i = i + 1
	elif a > b:
		if a >= 1:
			a = a - 1
			eldoor = 2
			i = i + 1
	elif b >= 1:
		b = b - 1
		eldoor = 1
		i = i + 1
print(int(x[1]) + int(x[2]) - a - b)


import math

def solve():
	(n, a, b) = [int(s) for s in input().split(' ')]
	s = input()
	gaps = []
	g = 0
	for c in s:
		if c == '.':
			g += 1
		elif g:
			gaps.append(g)
			g = 0
	if g:
		gaps.append(g)
	k = 0
	for gap in gaps:
		if a > b:
			(a, b) = (b, a)
		x = min(b, math.ceil(gap / 2))
		y = min(a, math.floor(gap / 2))
		b -= x
		a -= y
		k += x + y
	return k
print(solve())


(n, a, b) = map(int, input().split(' '))
s = input().split('*')
count = 0
for i in range(len(s)):
	if len(s[i]) != 0:
		if a == 0 and b == 0:
			break
		t = len(s[i])
		count += t
		if t % 2 == 0:
			a -= int(t / 2)
			b -= int(t / 2)
			if a < 0:
				count += a
				a = 0
			if b < 0:
				count += b
				b = 0
		else:
			if a >= b:
				a -= int(t / 2) + 1
				b -= int(t / 2)
			else:
				a -= int(t / 2)
				b -= int(t / 2) + 1
			if a < 0:
				count += a
				a = 0
			if b < 0:
				count += b
				b = 0
print(count)


(n, a, b) = map(int, input().split())
s = input()
segments = []
c = 0
pre = '.'
for i in range(len(s)):
	if pre == s[i]:
		c += 1
	elif c > 0:
		segments.append(c)
		c = 0
if c > 0:
	segments.append(c)
ans = 0
segments = sorted(segments, reverse=True)
for i in segments:
	if i % 2 == 0:
		xx = i // 2
		if xx <= a:
			a -= xx
			ans += xx
		else:
			ans += a
			a = 0
		if xx <= b:
			b -= xx
			ans += xx
		else:
			ans += b
			b = 0
	elif a > b:
		xx = i // 2 + 1
		if xx <= a:
			a -= xx
			ans += xx
		else:
			ans += a
			a = 0
		yy = i - xx
		if yy <= b:
			b -= yy
			ans += yy
		else:
			ans += b
			b = 0
	else:
		xx = i // 2 + 1
		if xx <= b:
			b -= xx
			ans += xx
		else:
			ans += b
			b = 0
		yy = i - xx
		if yy <= a:
			a -= yy
			ans += yy
		else:
			ans += a
			a = 0
print(ans)


(n, a, b) = [int(x) for x in input().split()]
lst = list(input())
s = 0
i = 0
while (a > 0 or b > 0) and n > i:
	if lst[0] == '.':
		if b > a and b > 0:
			lst[0] = 'S'
			b -= 1
			s += 1
		elif a > 0 and a >= b:
			lst[0] = 'P'
			a -= 1
			s += 1
	if lst[i] == '.':
		if lst[i - 1] == '*':
			if b > a and b > 0:
				lst[i] = 'S'
				b -= 1
				s += 1
			elif a > 0:
				lst[i] = 'P'
				a -= 1
				s += 1
		elif lst[i - 1] == 'S' and a > 0:
			lst[i] = 'P'
			a -= 1
			s += 1
		elif lst[i - 1] == 'P' and b > 0:
			lst[i] = 'S'
			b -= 1
			s += 1
		elif lst[i - 1] == '.':
			if b > a and b > 0:
				lst[i] = 'S'
				b -= 1
				s += 1
			elif a > 0:
				lst[i] = 'P'
				a -= 1
				s += 1
	i += 1
print(s)


(n, a, b) = map(int, input().split())
S = input()
A = list(S.split('*'))
A = [len(A[i]) for i in range(len(A))]
(a, b) = (min(a, b), max(a, b))
res = 0
i = 0
while a + b > 0 and i < len(A):
	(a, b) = (min(a, b), max(a, b))
	if A[i] % 2 == 0:
		res += min(a, A[i] // 2) + min(b, A[i] // 2)
		a -= min(a, A[i] // 2)
		b -= min(b, A[i] // 2)
	else:
		res += min(a, A[i] // 2) + min(b, A[i] // 2 + 1)
		a -= min(a, A[i] // 2)
		b -= min(b, A[i] // 2 + 1)
	i += 1
print(res)


(N, A, B) = map(int, input().split())
S = input()
orig = A + B
nums = [A, B]
pos = 0
new_start = True
for c in S:
	if c == '.':
		if new_start:
			pos = int(nums[0] < nums[1])
			new_start = False
		else:
			pos = not pos
		nums[pos] -= 1
	else:
		new_start = True
(A, B) = nums
res = orig - A - B
res += A if A < 0 else 0
res += B if B < 0 else 0
print(res)


(n, a, b) = map(int, input().split())
w = input()
(now, ans) = (0, 0)
for c in w:
	if c == '*':
		now = 0
		continue
	if a == b == 0:
		break
	if now == 0:
		if a > b:
			now = 2
			a -= 1
		else:
			now = 1
			b -= 1
		ans += 1
	elif now == 1:
		if a == 0:
			now = 0
			continue
		else:
			a -= 1
			now = 2
			ans += 1
	elif b == 0:
		now = 0
		continue
	else:
		b -= 1
		now = 1
		ans += 1
print(ans)


(n, a, b) = map(int, input().split())
ai = a
bi = b
s = input()
indices = []
sa = ['a'] * a
sb = ['b'] * b
dct = {'a': a, 'b': b}
s = s.split('*')
for i in s:
	if len(i) % 2:
		if a >= b:
			a -= len(i) // 2 + 1
			b -= len(i) // 2
		else:
			b -= len(i) // 2 + 1
			a -= len(i) // 2
	else:
		a -= len(i) // 2
		b -= len(i) // 2
	if a < 0:
		a = 0
	if b < 0:
		b = 0
print(ai - a + bi - b)


line = input().split(' ')
n = int(line[0])
a = int(line[1])
b = int(line[2])
string = input()
string = list(string)
for i in range(n):
	if string[i] == '.':
		if (b >= a and string[i - 1] != 'B' or string[i - 1] == 'A') and b > 0:
			string[i] = 'B'
			b = b - 1
		elif (a > b and string[i - 1] != 'A' or string[i - 1] == 'B') and a > 0:
			string[i] = 'A'
			a = a - 1
sum1 = 0
for i in range(n):
	if string[i] == 'A' or string[i] == 'B':
		sum1 = sum1 + 1
print(sum1)


(n, a, b) = map(int, input().split())
s = input()
s_ = sorted([len(el) for el in s.split('*') if el != str()])
s_0 = [el for el in s_ if el % 2 == 0]
s_1 = [el for el in s_ if el % 2 == 1]
ans = 0
while len(s_0) > 0 and a + b > 0:
	t = s_0[-1] // 2
	del s_0[-1]
	t_a = min(t, a)
	a -= t_a
	ans += t_a
	t_b = min(t, b)
	b -= t_b
	ans += t_b
while len(s_1) > 0 and a + b > 0:
	t = s_1[-1] // 2
	del s_1[-1]
	if a >= b:
		t_a = min(t + 1, a)
		a -= t_a
		ans += t_a
		t_b = min(t, b)
		b -= t_b
		ans += t_b
	else:
		t_a = min(t, a)
		a -= t_a
		ans += t_a
		t_b = min(t + 1, b)
		b -= t_b
		ans += t_b
print(ans)


import sys
from itertools import groupby
(n, a, b) = map(int, input().split())
total = a + b
for (k, v) in groupby(input()):
	if k == '*':
		continue
	m = len(list(v))
	if a > b:
		a -= (m + 1) // 2
		b -= m // 2
	else:
		b -= (m + 1) // 2
		a -= m // 2
a = max(a, 0)
b = max(b, 0)
print(total - a - b)


(n, a, b) = [int(i) for i in input().split()]
(p, s, tot) = (max(a, b), min(a, b), 0)
S = input()
for string in S.split('*'):
	(a, b) = divmod(len(string), 2)
	a1 = min(a + b, p)
	a2 = min(len(string) - a1, s)
	tot += a1 + a2
	p -= a1
	s -= a2
print(tot)


def main():
	(n, a, b) = map(int, input().split())
	s = input()
	ans = 0
	dot = 0
	while dot < len(s):
		ast = s.find('*', dot)
		if ast == -1:
			ast = len(s)
		seats = ast - dot
		if seats % 2 == 0:
			da = min(seats // 2, a)
			db = min(seats // 2, b)
			(a, b) = (a - da, b - db)
			ans += da + db
		elif a > b:
			da = min(seats // 2 + 1, a)
			db = min(seats // 2, b)
			(a, b) = (a - da, b - db)
			ans += da + db
		else:
			da = min(seats // 2, a)
			db = min(seats // 2 + 1, b)
			(a, b) = (a - da, b - db)
			ans += da + db
		dot = ast + 1
	print(ans)
main()


(n, a, b) = map(int, input().split())
lis = input() + '#'
ans = []
c = 0
for i in range(n + 1):
	if lis[i] == '.':
		c += 1
	else:
		if c > 0:
			ans.append(c)
		c = 0
an = 0
for i in ans:
	(a, b) = (max(a, b), min(a, b))
	if i % 2 == 0:
		t = min(a, i // 2)
		a -= t
		an += t + min(i // 2, b)
		b -= min(t, b)
	else:
		t = min(a, i // 2 + 1)
		a -= t
		an += t + min(b, i // 2)
		b -= min(i // 2, b)
print(an)


(n, a, b) = map(int, input().split())
s = input()
result = a + b
previous = ''
for i in range(len(s)):
	if s[i] == '.':
		if previous == 'a':
			previous = 'b'
			b -= 1
		elif previous == 'b':
			previous = 'a'
			a -= 1
		elif a > b:
			previous = 'a'
			a -= 1
		else:
			previous = 'b'
			b -= 1
	else:
		previous = '*'
print(result - max(0, a) - max(0, b))


(n, a, b) = map(int, input().split())
s = input().split('*')
count = 0
for i in range(len(s)):
	k = len(s[i])
	if k != 0:
		pr = 0
		if a > b:
			if a > 0:
				a -= 1
				k -= 1
				count += 1
				pr = 1
		elif b > 0:
			b -= 1
			k -= 1
			count += 1
			pr = 2
		while k > 0:
			if pr == 1:
				if b > 0:
					b -= 1
					pr = 2
					count += 1
				else:
					pr = 0
			elif pr == 2:
				if a > 0:
					a -= 1
					pr = 1
					count += 1
				else:
					pr = 0
			elif a > b:
				if a > 0:
					a -= 1
					count += 1
					pr = 1
				else:
					pr = 0
			elif b > 0:
				b -= 1
				count += 1
				pr = 2
			else:
				pr = 0
			k -= 1
print(count)


(amount_of_places, amount_of_programmists, amount_of_athletes) = [int(x) for x in input().split()]
places = input()
next_sit = 'a' if amount_of_athletes > amount_of_programmists else 'p'
count = 0
i = 0
while i < amount_of_places:
	if amount_of_programmists != 0 and amount_of_athletes != 0:
		if places[i] == '.':
			if places[i - 1] == '*':
				if amount_of_athletes > amount_of_programmists:
					next_sit = 'p'
					amount_of_athletes -= 1
					count += 1
					i += 1
				else:
					next_sit = 'a'
					amount_of_programmists -= 1
					count += 1
					i += 1
			elif next_sit == 'a':
				next_sit = 'p'
				amount_of_athletes -= 1
				count += 1
				i += 1
			else:
				next_sit = 'a'
				amount_of_programmists -= 1
				count += 1
				i += 1
		else:
			i += 1
	elif amount_of_athletes != 0:
		if places[i] == '.':
			if places[i - 1] == '*':
				next_sit = '-'
				amount_of_athletes -= 1
				count += 1
				i += 1
			elif next_sit == '-':
				next_sit = 'a'
				i += 1
			elif next_sit == 'a':
				next_sit = '-'
				amount_of_athletes -= 1
				count += 1
				i += 1
		else:
			i += 1
	elif amount_of_programmists != 0:
		if places[i] == '.':
			if places[i - 1] == '*':
				next_sit = '-'
				amount_of_programmists -= 1
				count += 1
				i += 1
			elif next_sit == '-':
				next_sit = 'p'
				i += 1
			elif next_sit == 'p':
				next_sit = '-'
				amount_of_programmists -= 1
				count += 1
				i += 1
		else:
			i += 1
	else:
		break
print(count)