Buggy python submission (verdict: Time Limit Exceeded):
N,A,B = map(int, input().split())
adds = A + B
times = (N-1) // (adds + 1)
boalsLen = adds * times
count = A * times


while True:
    if boalsLen > N:
        break
    
    tmpBoalsLen = boalsLen + A
    if tmpBoalsLen > N:
        addBoals = N - boalsLen
        count += addBoals
        break
    
    boalsLen = tmpBoalsLen
    boalsLen += B
    count += A

print(count)
    
    


Fixed submission:
N,A,B = map(int, input().split())
adds = A + B
times = N // adds
boalsLen = adds * times
count = A * times


while True:
    if boalsLen > N:
        break
    
    tmpBoalsLen = boalsLen + A
    if tmpBoalsLen > N:
        addBoals = N - boalsLen
        count += addBoals
        break
    
    boalsLen = tmpBoalsLen
    boalsLen += B
    count += A

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N,A,B = map(int, input().split())
boalsLen = 0
count = 0

while True:
    if boalsLen > N:
        break
    
    tmpBoalsLen = boalsLen + A
    if tmpBoalsLen > N:
        addBoals = N - boalsLen
        count += addBoals
        break
    
    boalsLen = tmpBoalsLen
    boalsLen += B
    count += A

print(count)

Fixed submission:
N,A,B = map(int, input().split())
adds = A + B
times = N // adds
boalsLen = adds * times
count = A * times


while True:
    if boalsLen > N:
        break
    
    tmpBoalsLen = boalsLen + A
    if tmpBoalsLen > N:
        addBoals = N - boalsLen
        count += addBoals
        break
    
    boalsLen = tmpBoalsLen
    boalsLen += B
    count += A

print(count)

Buggy python submission (verdict: Runtime Error):
N,A,B = map(int, input().split())
addBlue = 'b'*A
addRed = 'r'*B
count = 0
boals = ''

while len(boals) < N:
    boals += addBlue
    boals += addRed
    count += A

print(count - boals[N:len(boals)].count('b'))

Fixed submission:
N,A,B = map(int, input().split())
adds = A + B
times = N // adds
boalsLen = adds * times
count = A * times


while True:
    if boalsLen > N:
        break
    
    tmpBoalsLen = boalsLen + A
    if tmpBoalsLen > N:
        addBoals = N - boalsLen
        count += addBoals
        break
    
    boalsLen = tmpBoalsLen
    boalsLen += B
    count += A

print(count)

Buggy python submission (verdict: Runtime Error):
N,A,B = map(int, input().split())
addBlue = 'b'*A
addRed = 'r'*B
boals = ''

while len(boals) < N:
    boals += addBlue
    boals += addRed

print(boals[:N].count('b'))

Fixed submission:
N,A,B = map(int, input().split())
adds = A + B
times = N // adds
boalsLen = adds * times
count = A * times


while True:
    if boalsLen > N:
        break
    
    tmpBoalsLen = boalsLen + A
    if tmpBoalsLen > N:
        addBoals = N - boalsLen
        count += addBoals
        break
    
    boalsLen = tmpBoalsLen
    boalsLen += B
    count += A

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N,A,B = map(int, input().split())

boals = ''

while len(boals) < N:
    for i in range(A):
        boals += 'b'
    
    for i in range(B):
        boals += 'r'

print(boals[:N].count('b'))
    
    


Fixed submission:
N,A,B = map(int, input().split())
adds = A + B
times = N // adds
boalsLen = adds * times
count = A * times


while True:
    if boalsLen > N:
        break
    
    tmpBoalsLen = boalsLen + A
    if tmpBoalsLen > N:
        addBoals = N - boalsLen
        count += addBoals
        break
    
    boalsLen = tmpBoalsLen
    boalsLen += B
    count += A

print(count)