Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ball=('b'*A+'r'*B)*10**7
if B <= N:
    print(ball.count('b',0,N))
else:
    print(N)



Fixed submission:
N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ball=('b'*A+'r'*B)*N
print(ball[0:N].count('b'))

Fixed submission:
N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
c='b'*A+'a'*B
import math
for i in range(math.ceil(N/(A+B))+1):
    d=i*c
print(d.count('b',0,N))

Fixed submission:
N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
c='b'*A+'a'*B
for i in range(N):
    d=i*c
print(d.count('b',0,N))

Fixed submission:
N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
c=N//(A+B)
ball=('b'*A+'a'*B)*(c+1)
print(ball.count('b',0,N))


Fixed submission:
N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
import math
c=math.ceil(N/(A+B))
ball=('b'*A+'a'*B)*c
print(ball.count('b',0,N))


Fixed submission:
N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
import math
c=math.ceil(N/(A+B))
ball=('b'*A+'a'*B)*c
print(ball.count('b',0,N))


Fixed submission:
N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ball=('b'*A+'a'*B)*10**18
print(ball.count('b',0,N))


Fixed submission:
N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ball=('b'*A+'a'*B)*10**18
print(ball.count('b',0,N))


Fixed submission:
N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ball=('b'*A+'a'*B)*10**9
print(ball.count('b',0,N))


Fixed submission:
N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ball=('b'*A+'a'*B)*10**7
print(ball.count('b',0,N))


Fixed submission:
N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ball=('b'*A+'a'*B)*100
print(ball.count('b',0,N))


Fixed submission:
N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ball=('b'*A+'a'*B)*100
print(ball[0:N].count('b'))

Fixed submission:
N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ball=('b'*A+'a'*B)*10
print(ball[0:N].count('b'))

Fixed submission:
N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ball=('b'*A+'a'*B)*10000
print(ball[0:N].count('b'))

Fixed submission:
N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ball=('b'*A+'a'*B)*N
print(ball[0:N].count('b'))

Fixed submission:
N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ball=('b'*A+'a'*B)*10000
print(ball[0:N].count('b'))N,A,B=map(int,input().split())
ball=('b'*A+'a'*B)*N
print(ball[0:N].count('b'))

Fixed submission:
N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))