TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N,A,B=map(int,input().split())

elif N%(A+B)<=A:
    print(N//(A+B)*A+N%(A+B))
else:
    print(N//(A+B)*A+A)

N,A,B=map(int,input().split())

if N%(A+B)<=A:
    print(N//(A+B)*A+N%(A+B))
else:
    print(N//(A+B)*A+A)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N, B, R = map(int, input().split())

ans = (N // (B+R)) * B
print(ans)


rest = N % (B+R)

print(rest)

if rest < B:
  print(ans+rest)
else:
  print(ans+B)  

N, B, R = map(int, input().split())

Line = ''

print(N)

while(N > len(Line)):
  for i in range(B):
    Line += 'b'
  for i in range(R):
    Line += 'r'

ans = Line[:N].count('b')

print(ans)

N, B, R = map(int, input().split())

ans = (N // (B+R)) * B
rest = N % (B+R)

if rest <= B:
  print(ans+rest)
else:
  print(ans+B) 

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, a, b = [int(x) for x in input().split()]

if a == 0 and b == 0:
    print("0")
elif a >= n:
    print(n)
else:
    x = n // (a + b)
    if x == 0:
        print(a)
    else:
        if (n - ((a + b) * x)) >= a:
            print(a * x + a)
        else:
            print((a + b) * x)


n, a, b = [int(x) for x in input().split()]

if a == 0 and b == 0:
    print("0")
elif a >= n:
    print(n)
else:
    x = n // (a + b)
    if x == 0:
        print(a)
    else:
        if (n - b * x) <= a:
            print(n - b * x)
        else:
            print(a * x + a)


n, a, b = map(int, input().split())

q, r = divmod(n, (a + b))

answer = a * q + min(a, r)
print(answer)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, a, b = map(int, input().split())

ans = n //(a+b) * a
rem = n % (a+b)
ans += rem

n, a, b = map(int, input().split())

ans = n //(a+b) * a
rem = n % (a+b)
ans += min(rem, a)

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, a, b = map(int, input().split())

c = n - 2 - 4
print(a + c)

n, a, b = map(int, input().split())

q = n // (a + b)
m = n % (a + b)

if m <= a:
    print(q * a + m)
else:
    print(q * a + a)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
import math
from collections import deque
def main():
    n,a,b = tuple([int(t)for t in input().split()])

    if b == 0:
        print(n)
    else:
        print(min(n,a))

if __name__ == "__main__":
    main()

n,a,b = tuple(map(int,input().split()))

ans = n//(a+b)*a

ans += min(n%(a+b),a)

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N,B,R = map(int,input().split())
k = N % (B + R)
k2 = int(N / (B + R))
#s = ("b"*B + "r"*R)

#s1 = s[:k]
if k >= B:
	print(k2*(B) + k)
else:
	print(k2*(B) + B)


N,B,R = map(int,input().split())
k = N % (B + R)
k2 = int(N / (B + R))
#s = ("b"*B + "r"*R)

#s1 = s[:k]
if k <= B:
	print(k2*(B) + k)
else:
	print(k2*(B) + B)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N,A,B = map(int,input().split())

if A == 0:
    print(0)
else:
    if N > A+B:
        a = N / (A+B)
        b = N % (A+B)
        if b > A:
            b = A
        print(a*A + b)
    else:
        if A > N:
            print(N)
        else:
            print(A)

N,A,B = map(int,input().split())

if A == 0:
    print(0)
else:
    if N > A+B:
        a = N // (A+B)
        b = N % (A+B)
        if b > A:
            b = A
        print(a*A + b)
    else:
        if A > N:
            print(N)
        else:
            print(A)
            

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N,A,B=list(map(int,input().split()))
a=N//(A+B)*A
print(a)

N,A,B=list(map(int,input().split()))
a=N//(A+B)*A
if N==A+B:
  print(a)
else:
  print(a+min(N%(A+B),A))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N, A, B = map(int, input().split())
C = 0
while True:
    if N <= 0:
        break
    if A > 0:
        if N - A <= 0:
            print(N)
            break
        else:
            C = C + A
            N = N - A  
    else:
        print(0)
        break
    N = N - B
print(C)

N, A, B = map(int, input().split())
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
a,b,c=input().strip().split(" ")
a,b,c=[int(a),int(b),int(c)]
p=b+c
x=a//p
m=a%p
pp=min(b,m)
print(pp+x*a)

a,b,c=input().strip().split(" ")
a,b,c=[int(a),int(b),int(c)]
p=b+c
x=a//p
m=a%p
pp=min(b,m)
print(pp+x*b)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
# B
n, a, b = map(int, input().split())

if n <= a+b:
    if n >= a:
        print(a)
    elif n < a:
        print(n)
elif n > a+b:
    ans = (n//(a+b))*a
    if n-ans >= a:
        print(ans+a)
    elif n < a:
        print(ans+n)

# B
n, a, b = map(int, input().split())

if n <= a+b:
    if n >= a:
        print(a)
    elif n < a:
        print(n)
elif n > a+b:
    ans = (n//(a+b))*a
    if n-ans >= a:
        print(ans+a)
    elif n-ans < a:
        print(ans+n)

# B
n, a, b = map(int, input().split())

if n <= a+b:
    if n >= a:
        print(a)
    elif n < a:
        print(n)
elif n > a+b:
    taba = n//(a+b)
    if n-taba*(a+b) >= a:
        print(taba*a+a)
    elif n-taba*(a+b) < a:
        print(taba*a+n)

# B
n, a, b = map(int, input().split())

if n <= a+b:
    if n >= a:
        print(a)
    elif n < a:
        print(n)
elif n > a+b:
    taba = n//(a+b)
    if n-taba*(a+b) >= a:
        print(taba*a+a)
    elif n-taba*(a+b) < a:
        print(taba*a+n-taba*(a+b))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b=map(int,input().split())
ans=0
if a==0:
    ans=0
elif b==0:
    ans=n
elif n>(a+b):
    ans=a*(n//(a+b))
    n=n%(a+b)
else:
    while True:
        if n==0:
            break
        if n-a>=0:
            n-=a
            ans+=a
        else:
            ans+=n
            break
        n-=b
        if n<=0:
            break
print(ans)



n,a,b=map(int,input().split())
ans=0
if a+b>=2:
    ans=n//(a+b)
elif a==0:
    ans=0
elif b==0:
    ans=n
elif n%(a+b)-b<0:
    ans+=n%(a+b)
else:
    ans+=n%(a+b)-b
print(ans)


n,a,b=map(int,input().split())
ans=n//(a+b)
if a==n:
    ans=n
elif a==0:
    ans=0
elif n%(a+b)-b<0:
    ans+=n%(a+b)
else:
    ans+=n%(a+b)-b
print(ans)


#abc 158 b

n,a,b=map(int,input().split())
ans=0
if a+b>=2:
    ans=n//(a+b)
elif a==0:
    ans=0
elif b==0:
    ans=n
elif n%(a+b)-b<0:
    ans+=n%(a+b)
else:
    ans+=n%(a+b)-b
print(ans)


n,a,b=map(int,input().split())
ans=0
if a==0:
    ans=0
elif b==0:
    ans=n
elif n>(a+b):
    ans=a*(n//(a+b))
    n=n%(a+b)
else:
    while True:
        if n-a>=0:
            n-=a
            ans+=a
        else:
            ans+=n
            break
        n-=b
        if n<=0:
            break
print(ans)

n,a,b=map(int,input().split())
ans=0
if a==0:
    ans=0
elif b==0:
    ans=n
else:
    ans=a*(int(n/(a+b)))
    n=n%(a+b)
    while True:
        if n==0:
            break
        if n-a<0:
            ans+=n
            break
        else:
            ans+=a
            break

print(ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b = map(int,input().split())

 n//(a+b)

sum = 0
if n >= a:
    while(n > a):
        n = n-a-b
        sum += a
    print(sum+n)
else:
    print(n)

n,a,b = map(int,input().split())

sum = n//(a+b)*a
res = n%(a*b)
sum += min(res,a)

print(sum)

n,a,b = map(int,input().split())

sum = 0
if n >= a:
    while(n > a):
        n = n-a-b
        sum += a
print(sum+n)
else:
    print(a)

n = int(input())
a = int(input())
b = int(input())

sum = 0

while(n > a):
    n = n-a-b
    sum += a

print(sum+n)

n,a,b = map(int,input().split())

sum = n//(a+b)*a
res = n%(a+b)
sum += min(res,a)

print(sum)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N, A, B = map(int, input().split())

x = N // (A+B)
y = N % (A+B)
if A < y:
  sum = A*X + A
else:
  sum = A*X + y
print(sum)

N, A, B = map(int, input().split())
 
x = N // (A+B)
y = N % (A+B)
sum = A*x + min(A, y)
print(sum)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b=input().split()

tmp1,tmp2=divmod(N,a+b)

blue=tmp1*a
if(tmp2>a):
  blue=blue+a
eles:
  blue=blue+tmp2
  
print("blue")

n,a,b=map(int,input().split())

tmp1,tmp2=divmod(n,a+b)

blue=tmp1*a
if(tmp2>a):
  blue=blue+a
else:
  blue=blue+tmp2
  
print(blue)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N, A, B = map(int, input().split())
len_loop = A + B
n_comp_loop = N//len_loop
blue_res = max(A, N % len_loop)
print(n_comp_loop * A + blue_res)


N, A, B = map(int, input().split())
len_loop = A + B
n_comp_loop = N//len_loop
blue_res = min(A, N % len_loop)
print(n_comp_loop * A + blue_res)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b=map(int,input().split());m=n//(a+b)*a;print(m,n-m)

n,a,b=map(int,input().split());m=n//(a+b);print(m*a+max(0,n%(a+b)-b))

n,a,b=map(int,input().split());m=n//(a+b);print(m*a+max(a,n-m*(a+b)))

n,a,b=map(int,input().split());m=n//(a+b);print(m*a,n-m*(a+b))

n,a,b=map(int,input().split());b+=a;print(n//b*a+min(a,n%b))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b=map(int, input().split())
count=n//a+b*a
n=n%(a+b)
count+=min(n,a)
print(count)


n,a,b=map(int, input().split())
count=n//(a+b)*a
n=n%(a+b)
count+=min(n,a)
print(count)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, a, b = list(map(int, input().split()))
result = 0
if a + b != 0:
  roop = n // (a +b)
  extra = n - roop*(a+b)
  print(extra)
  result = a*roop
  if extra >= a:
    result += a
  else:
    result += extra
print(result)

n, a, b = list(map(int, input().split()))
result = 0
if a + b != 0:
  roop = n // (a +b)
  extra = n - roop*(a+b)
  result = a*roop
  if extra >= a:
    result += a
  else:
    result += extra
print(result)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, a, b = map(int, input().split())
print(n, a, b)

ans = 0
if a > 0:
    ans += (a * (n // (a + b)))
    if (n % (a + b)) >= a:
        ans += a
    else:
        ans += (n % (a + b))
print(ans)

n, a, b = map(int, input().split())
print(n, a, b)

ans = 0
if a > 0:
    ans += (a * (n // (a + b)))
    if 0 < (n % (a + b)) < a:
        ans += (n % (a + b))
    else:
        ans += a
print(ans)

n, a, b = map(int, input().split())
print(n, a, b)

ans = 0
if a > 0:
    ans = a * (n // (a + b)) + (n % (a + b)) if (n % (a + b)) < a else a
print(ans)

n, a, b = map(int, input().split())
print(n, a, b)

ans = 0
if a > 0:
    ans += (a * (n // (a + b)))
    if (n % (a + b)) > a:
        ans += a
    else:
        ans += (n % (a + b))
print(ans)

n, a, b = map(int, input().split())
print(n, a, b)

ans = 0
if a > 0:
    ans += a * (n // (a + b))
    if 0 < n % (a + b) < a:
        ans += n % (a + b)
    else:
        ans += b
print(ans)

n, a, b = map(int, input().split())
print(n, a, b)

ans = 0
if a > 0:
    ans += a * (n // (a + b))
    if 0 < n % (a + b) < a:
        ans += n % (a + b)
    else:
        ans += a
print(ans)


n, a, b = map(int, input().split())
ans = 0
if a > 0:
    ans += (a * (n // (a + b)) + min(n % (a + b), a))
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N, A, B = map(int,input().split())
AB = A + B
n = N//AB
print(n*A)

import sys
N, A, B = map(int,input().split())
AB = A + B
n = N//AB
amari = N%AB
if A >= N:
  print(N)
  sys.exit()
if AB > N:
  print(A)
  sys.exit()
add = min(amari, A)
print(n*A + add)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, a,b = map(int, input().split())
ans = n//(a+b)
rem = n%(a+b)
ans+=min(a,rem)
print(ans)

import math
n , a , b  = map(int, input().split())
if a >= n : exit(print(n))
ans = n/(a+b)
print(math.floor(ans*a))

import math
n , a , b  = map(int, input().split())
if a >- n : exit(print(n))
ans = n/(a+b)
print(math.ceil(ans*a))

n, a,b = map(int, input().split())
ans = n//(a+b)*a
rem = n%(a+b)
ans+=min(a,rem)
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, b, r = map(int, input().split())
b1 = n//(b+r)
b2 = n % (b+r)
if b == 0:
    print(0)
elif n % (b+r) != 0:
    b1 = b1*b + b
    print(b1)
elif n % (b+r) == 0:
    print(b1*b)


n, b, r = map(int, input().split())
b1 = n//(b+r)
b2 = n % (b+r)
if b == 0:
    print(0)
elif r == 0:
    print(n)
elif b2 != 0 and b2 <= b:
    b1 = b1*b + b2
    print(b1)
elif b2 != 0 and b2 > b:
    b1 = b1*b + b
    print(b1)
elif n % (b+r) == 0:
    print(b1*b)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N,A,B=map(int, input().split())
len=A+B
print((N / len)* A + min(A, N % len))


N,A,B=map(int, input().split())
len=A+B
print((N // len)* A + min(A, N % len))


Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b=map(int,input().split())
temp1=n//(a+b)
temp=n-temp1
ans=min(a,temp)
ans+=(temp1*a)
print(ans)


n,a,b=map(int,input().split())
temp1=n//(a+b)
temp=n-temp1
ans=min(a,temp)
ans+=(temp1*a)
print(ans)


n,a,b=map(int,input().split())
temp1=n//(a+b)
temp=n-(temp1*(a+b))
ans=min(a,temp)
ans+=(temp1*a)
print(ans)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, a, b = map(int, input().split())
box = []
ans = []

while n > len(box):
    box1 = [('b') for _ in range(a)]
    box2 = [('r') for _ in range(b)]
    box.extend(box1)
    box.extend(box2)
    
m = n - len(box)

if m < 0:
    del box[m:]

print(box, box.count('b'))

n, a, b = map(int, input().split())

c = n // (a + b)
d = n - (a+b) * c
ans = a * c

if a > d:
    ans += d
else:
    ans += a

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, a, b = map(int, input().split())

ans = n // (a + b)
ans *= a

print(ans)

n, a, b = map(int, input().split())

ans = n // (a + b)
ans *= a

if n % (a + b) != 0:
   ans += min(a, n % (a + b))

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
import sys

N,A,B = map(int,input().split(' '))

Count_Blue = 0
if 1<=N<=10**18 and A > 0 and B >= 0 and \
   0< A + B <= 10**18:
    Add_Blue = 1 * A
    Add_Both = Add_Blue + 1 * B

    q = N // Add_Both
    mod = N % Add_Both
    if mod < Add_Blue:
        Count_Blue = (q *Add_Blue) + mod
        print(Count_Blue)
    else:
        Count_Blue = (q * Add_Blue) + Add_Blue
    print(Count_Blue)
elif A == 0:
    print(Count_Blue)

import sys

N,A,B = map(int,input().split(' '))

Count_Blue = 0
if 1<=N<=10**18 and A > 0 and B >= 0 and \
   0< A + B <= 10**18:
    Add_Blue = 1 * A
    Add_Both = Add_Blue + 1 * B

    q = N // Add_Both
    mod = N % Add_Both
    if mod < Add_Blue:
        Count_Blue = (q *Add_Blue) + mod
    else:
        Count_Blue = (q * Add_Blue) + Add_Blue
    print(Count_Blue)
elif A == 0:
    print(Count_Blue)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b = map(int,input().split())
if a>n:
  print(a)
ans = 0
else:
  temp = N//(a+b)
  ans = temp*a
  temp2 = N- temp
  if temp2 < a:
    print(ans+temp2)
  else:
    print(ans+a)

n,a,b = map(int,input().split())
temp = n//(a+b)
ans = temp*a
temp2 = n%(a+b)
print(ans+min(temp2,a)) 

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b = map(int,input().split())

k = n//(a+b) + 
L = ["b"]*a +["r"]*b
L = L*k
print(L[0:n+1].count("b"))

n,a,b = map(int, input().split())

x = n//(a+b)
y = n % (a+b)

if y <= a:
  print(a * x + y)
else:
  print(a*x + a)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b=map(int,input().split());a+b=c;print(n//c+max(n%c-a,0))

n,a,b=map(int,input().split());a+b=c;print(n//c+n%c)

n,a,b=map(int,input().split());c=a+b;print(n//c+max(n%c-a,0))

n,a,b=map(int,input().split());c=a+b;print(n//c+n%c)

n,a,b=map(int,input().split());c=a+b;print((n//c)*a+min(n%c,a))

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
a8, a10 = input().split(' ')
a8 = int(a8)
a10 = int(a10)
 
value1 = int(a8 / 0.08)
value2 = int(a10 / 0.1)

if int(value1 * 0.1) == a10:
  if value1 > value2:
    print(value1)
  else:
    print(value2)
elif int(value2 * 0.08 == a8):
  if value1 > value2:
    print(value1)
  else:
    print(value2)
else:
  print(-1)

s = input()
n, a, b = s.split(' ')
n = int(n)
a = int(a)
b = int(b)
na = n / (a+b) * a 
if n % (a+b) >= a :
  na += a
else:
  na += n % (a+b)
  
print(na)

N,A,B = map(int, input().split())

i = N // (A+B)
b = i*A
t = N % (A+B)

if t > A:
  t = A
  
print(b+t)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N, A, B = map(int, input().split())
2 ans = N // (A + B) * A
3 rem = N % (A + B)
4 ans += min(rem, A)
5 print(ans)

N, A, B = map(int, input().split())
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N, A, B = map(int, input().split())
blue = 'b' * A
red = 'r' * B
str = ''

for _ in range(N):
  for i in range(A):
    if len(str) < N:
      str += blue
  for j in range(B):
    if len(str) < N:
      str += red

print(str.count('b'))

N, A, B = map(int, input().split())
print((N // (A + B) * A) + min(A, N % (A + B)))

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b=map(int,input().split())
if n%(a+b)>=a:
  s=a
  
else:
  s=n%(a+b)
print(n//(a+b)+s)

n,a,b=map(int,input().split())
if n%(a+b)>=a:
  s=a
  
else:
  s=n%(a+b)
print(n//(a+b)*a+s)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
a,b,c=map(int,input().split())
if b==0:
  print(0)
else:
  print(a//(b+c)+a%(b+c))

a,b,c=map(int,input().split())
if b==0:
  print(0)
else:
  print(b*(a//(b+c))+min(b,a%(b+c)))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b = map(int,input().split())
ans = 0
q = n // (a+b)
print(q)
ans += q*a
q = n - (a+b)*q
print(q)
if q - a >= 0:
    ans += a
if q - a < 0:
    ans = ans + a +(q-a)
print(ans)

n,a,b = map(int,input().split())
ans = 0
q = n // (a+b)

ans += q*a
q = n - (a+b)*q

if q - a >= 0:
    ans += a
if q - a < 0:
    ans = ans + a +(q-a)
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b=map(int,input().split())

ans=n//(a+b)
ans=a*ans
hoge=n%(a+b)%1
if(hoge>a):
  ans+=hoge-a
else:
  ans+=hoge

print(int(ans))

n,a,b=map(int,input().split())

ans=n//(a+b)
ans=a*ans
hoge=n%(a+b)
if(hoge>a):
  ans+=a
else:
  ans+=hoge

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
a,b,c=input().split()

if a==b+c:
  print(b)
elif b==0:
  print(0)
else:
  print(a-c+b)

S,a,b=(int(x) for x in input().split())
ans = S//(a+b) * a
rem = S % (a+b )
ans +=min(rem,a)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
import sys

read = sys.stdin.readline
T = read()
a, b, c = map(int, T.split())

temp = a // (b+c)
answer = temp * b
temp2 = a % (b+c)

if temp2 >= b:
    answer += b
else:
    answer += temp2

print(temp2) 



import sys

read = sys.stdin.readline
T = read()
a, b, c = map(int, T.split())

if b == 0:
    print(0)
else if b == 8:
    print(8)
else:
    print(a-c)

import sys

read = sys.stdin.readline
T = read()
a, b, c = map(int, T.split())

temp = a // (b+c)
answer = temp * b
temp2 = a % (b+c)

if temp2 >= b:
    answer += b
else:
    answer += temp2

print(answer) 



Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, b, r = map(int,input().split())

rep = n // (a+b)
mod = n % (a+b)
ans = rep * b

if mod > a:
	ans+= a  
else:
    ans+= mod
print(ans)

n, b, r = map(int,input().split())
 
rep = n // (b+r)
mod = n % (b+r)
ans = rep * b
 
if mod > b:
	ans+= b  
else:
    ans+= mod
print(ans)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N, A, B  = [int(x) for x in input().split(" ")]

if A == 0:
  print(0)
elif N%(A+B) == 0:
  print(int(N/(A+B))*A)
else:
  print(int(N/(A+B))*A+int(min(N%A+B,A)))

N, A, B  = [int(x) for x in input().split(" ")]

print(int(N/(A+B))*A)+int(min(N%(A+B),A))


N, A, B  = [int(x) for x in input().split(" ")]


if N%(A+B) == 0:
  print(int(N/(A+B))*A)
else:
  print(int(N/(A+B))*A)+int(min(N%(A+B),A))


N, A, B  = [int(x) for x in input().split(" ")]

print(int(N/(A+B))*A+int(min(N%(A+B),A)))

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N, A, B = map(int, input().split())
F = A + B
C = N / F
D = N % C
E = A * C
if A == 0:
  print(0)
elif B == 0:
  print(A)
elif C == 0:
  if N < A:
    print(N)
  else:
    print(A)
else:
  if D < A:
    print(E + D)
  else:
    print(E + A)
  

N, A, B = map(int, input().split())
F = A + B
C = N // F
D = N % C
E = A * C
if A == 0:
  print(0)
elif B == 0:
  print(A)
elif C == 0:
  if N < A:
    print(N)
  else:
    print(A)
else:
  if D < A:
    print(E + D)
  else:
    print(E + A)
  


N, A, B = map(int, input().split())
F = A + B
C = N // F
D = N % C
E = A * C
if A == 0:
  print(0)
elif B == 0:
  if A > N:
    print(A - N)
  else:
    print(N)
elif C == 0:
  if N < A:
    print(N)
  else:
    print(A)
else:
  if D < A:
    print(E + D)
  else:
    print(E + A)
  


N, A, B = map(int, input().split())
C = N // (A + B) * A + N % (A + B)
D = N // (A + B) * A + A
if A == 0:
    print(0)
elif B == 0:
    print(N)
elif N % (A + B) > A:
    print(D)
else:
    print(C)

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N,A,B=map(int,input().split())
N, A, B = map(int, input().split())
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)

N, A, B = map(int, input().split())
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b=map(int,input().split())
x=n/(a+b)-n%(a+b)
c=n-(a+b)*x
print(int(a*x+min(c,a)))

n,a,b=map(int,input().split())
x=n//(a+b)
c=n-(a+b)*x
print(int(a*x+min(c,a)))


Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b = map(int,input().split())
s = a+b
c = n % s
d = n // s

if c <= a:
  print( a*d + s )

else:
  print( a*d + a )
  


n,a,b = map(int,input().split())
s = a+b
c = n % s
d = n // s

if s <= a:
  print( a*d + s )

else:
  print( a*d + a )
  

n,a,b = map(int,input().split())
s = a+b
c = n % s
d = n // s

if c <= a:
  print( a*d + c )

else:
  print( a*d + a )

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b=map(int, input().split())
tmp = 0
if n%a+b>a:
    tmp = a
else:
    tmp = 0
print((n//(a+b))*a+tmp)

n,a,b=map(int, input().split())
(n//(a+b))*a+n%(a+b)

n,a,b=map(int, input().split())
tmp = 0
if n%a+b>a:
    tmp = a
else
    tmp = n%a+b
print((n//(a+b))*a+tmp)

n,a,b=map(int, input().split())
tmp = n%(a+b)
if tmp>a:
    tmp = a
print((n//(a+b))*a+tmp)

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, a, b = list(map(int, input().split()))
print( (n // (a+b)) * a + abs((n % (a+b)) - a))

n=input()
i=0
a=input()
b=input()
c=0
while True:
    for j in range(a):
        if i >= n:break
        i+=1
        c+=1
    for j in range(b):
        i+=1
    if i > n:break
print(c)


def count_balls(n, a, b):
    if(a==0): return 0
    if(n<a): return n
    end = n % (a+b)
    if(end > a):
        return a*(n//(a+b))+a
    else:
        return a*(n//(a+b))+end
n,a,b=map(int, input().strip().split())
print(count_balls(n,a,b))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N, A, B = map(int, input().split())
 
tmp1 = N // (A + B)
tmp2 = N % (A + B)
 
print(tmp1 * A + mim(tmp2, A))

N, A, B = map(int, input().split())
 
tmp1 = N // (A + B)
tmp2 = N % (A + B)
 
print(tmp1 * A + min(tmp2, A))

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N,A,B=map(int,input().split())

ope=10**100

amari=ope % (A+B)

ao=min(amari,A)
ao+=(N-amari)//(A+B)*A
if (N-amari)%(A+B) > B:
    ao+=(N-amari)%(A+B)-B

print(ao)

N,A,B=map(int,input().split())

ans=N//(A+B)*A + min(N%(A+B),A)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N,A,B=map(int(),input().split())
K=A*int(N/(A+B))
amari=N%(A+B)
i=1
while ((amari-i)>0):
  i=i+1
K=K+i
print(K)

N,A,B=map(int(),input().split())
K=A*int(N/(A+B))
amari=N%(A+B)
i=1
while ((amari-i)>0):
  i=i+1
K=K+i
  

N,A,B=map(int,input().split())
K=A*int(N/(A+B))
amari=N%(A+B)
if (amari>=A):
  i=A
elif (amari<A):
  i=amari
K=K+i
print(K)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
import sys
n, a, b = map(int, sys.stdin.readline().split())
balls = n * a / (a+b)
if n % (a+b) <= a:
  balls += n % (a+b)
else:
  balls += a
print(balls)

import sys
n, a, b = map(int, sys.stdin.readline().split())
balls = n // (a+b) * a
if n % (a+b) <= a:
  balls += n % (a+b)
else:
  balls += a
print(balls)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
# -*- coding: utf-8 -*-
i_str = input()
N,A,B = map(int,i_str.split())

import sys
AB = A+B
maxnum = pow(10,100)
if A == 0:
    print(0)
    sys.exit()
if N <= A:
    print(N)
    sys.exit()
waru,amari = divmod(B,AB)

#amari = N % AB
if amari > A:
    amari = A
answer = waru * A + amari

print(answer)

# -*- coding: utf-8 -*-
i_str = input()
N,A,B = map(int,i_str.split())

import sys
AB = A+B
maxnum = pow(10,100)
if A == 0:
    print(0)
    sys.exit()
if N <= A:
    print(N)
    sys.exit()
waru,amari = divmod(N,AB)

#amari = N % AB
if amari > A:
    amari = A
answer = waru * A + amari
print(answer)

Verdicts: Wrong Answer

Accepted