problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p02754
u674588203
2,000
1,048,576
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?
["N,A,B=map(int,input().split())\nab='u'*A+'r'*B\nS=ab*10**100\nS4ans=S[:N]\nprint(S4ans.count('u'))", "N,A,B=map(int,input().split())\nab='u'*A+'r'*B\nS=ab*1000\nS4ans=S[:N-1]\nprint(S4ans.count('u'))", 'N,A,B=map(int,input().split())\nfull=N//(A+B)\nrest=N%(A+B)\nif rest <=A:\n print(full*A+rest)\n exit()\nelse:\n print(full*A+A)\n exit()']
['Runtime Error', 'Runtime Error', 'Accepted']
['s217106592', 's251983887', 's344259105']
[3060.0, 4724.0, 2940.0]
[17.0, 19.0, 18.0]
[94, 93, 141]
p02754
u676608154
2,000
1,048,576
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?
['n, b, r = map(int, input().split())\ni = 1\nb_count = 0\nwhile n:\n if i%2 == 0:\n if n > b:\n b_count += b\n n = n-b\n else:\n b_count += n\n n = 0\n else:\n if n > r:\n n = n-r\n else:\n n = 0\n i += 1\nprint(b_count)', 'N,A,B = map(int, input().split())\nans = N // (A + B) * A\nrem = N % (A + B)\nans += min(rem, A)\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s567432701', 's531303697']
[3060.0, 2940.0]
[2107.0, 18.0]
[247, 105]
p02754
u677121387
2,000
1,048,576
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?
['n,a,b = map(int,input().split())\nans = (n//(a+b))*a\nans += min((n-n%(a+b)),a)\nprint(ans)', 'n,a,b = map(int,input().split())\nans = (n//(a+b))*a + min(n%(a+b),a)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s560739214', 's612876063']
[2940.0, 2940.0]
[17.0, 19.0]
[88, 79]
p02754
u677842374
2,000
1,048,576
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?
['N, A, B = map(int, input().split())\nkaisu = N//(A+B)\nprint(kaisu)\nn = N-((A+B)*kaisu)\nif n >= A:\n print(A*(kaisu+1))\nelse:\n print(A*kaisu+n)', 'N, A, B = map(int, input().split())\nkaisu = N//(A+B)\n\nn = N-((A+B)*kaisu)\nif n >= A:\n print(A*(kaisu+1))\nelse:\n print(A*kaisu+n)']
['Wrong Answer', 'Accepted']
['s620817470', 's787437835']
[3060.0, 2940.0]
[17.0, 18.0]
[146, 134]
p02754
u681811488
2,000
1,048,576
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?
['n,a,b = map(int, input().split())\n\nx = int(n/(a+b))\ny = (a+b)%n\nz = 0\nif y <= a :\n z = y\nelse :\n z = a\n \nprint(x*a+z)\n', 'n,a,b = map(int, input().split())\n \nx = n//(a+b)\ny = n%(a+b)\nz = 0\nif y <= a :\n z = y\nelse :\n z = a\n \nprint(x*a+z)']
['Wrong Answer', 'Accepted']
['s822327322', 's725511068']
[2940.0, 3060.0]
[20.0, 17.0]
[121, 117]
p02754
u685684561
2,000
1,048,576
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?
['n,a,b=input(),input(),input()\nn=int(n)\na=int(a)\nb=int(b)\nk=n//(a+b)*a+min(a,n%(a+b))\n \nprint(k)', 'n,a,b=input(),input(),input()\nn=int(n)\na=int(a)\nb=int(b)\nk=n//(a+b)*a+min(a,n%(a+b))\n \nprint(k)', 'n,a,b=input(),input(),input()\nk=n//(a+b)*a+min(a,n%(a+b))\n \nprint(k)', 'n,a,b=input(),input(),input()\nn=int(n)\na=int(a)\nb=int(b)\nk=n//(a+b)*a+min(a,n%(a+b))\n \nprint(k)', 'n,a,b=map(int, input().split())\nk=n//(a+b)*a+min(a,n%(a+b))\n \nprint(k)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s190437275', 's414938314', 's557188501', 's777566173', 's623305794']
[3064.0, 2940.0, 2940.0, 2940.0, 2940.0]
[28.0, 18.0, 17.0, 17.0, 17.0]
[96, 96, 69, 96, 71]
p02754
u689835643
2,000
1,048,576
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?
['a = list(map(int, input().split()))\nN = a[0]\nA = a[1]\nB = a[2]\ncount = 0\ni = N % (A + B) \nj = N //(A + B)\nif i >= A:\n i == A\ncount = j * A + i\n', 'a = list(map(int, input().split()))\nN = a[0]\nA = a[1]\nB = a[2]\ncount = 0\ni = N % (A + B) \nj = N //(A + B)\nif i >= A:\n i = A\ncount = j * A + i', 'a = list(map(int, input().split()))\nN = a[0]\nA = a[1]\nB = a[2]\ncount = 0\ni = N % (A + B) \nj = N //(A + B)\nif i >= A:\n i = A\ncount = j * A + i\nprint(count)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s451440367', 's863744466', 's103638667']
[2940.0, 3060.0, 3188.0]
[17.0, 17.0, 19.0]
[144, 142, 155]
p02754
u692498898
2,000
1,048,576
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?
['n,a,b=map(int,input().split())\nif n%(a+b)<=b:\n print(n//(a+b)*b+n%(a+b))\nelse:\n print(n//(a+b)*b+b)', 'n,a,b=map(int,input().split())\nif n%(a+b)<=a:\n print(n//(a+b)*a+n%(a+b))\nelse:\n print(n//(a+b)*a+a)']
['Wrong Answer', 'Accepted']
['s401795618', 's277198748']
[2940.0, 2940.0]
[17.0, 17.0]
[101, 101]
p02754
u694665829
2,000
1,048,576
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?
['N,A,B=map(int,input().split())\nans=N//(A+B)*A\nrem=N%(A+B)\nans+=ans+min(rem,A)\nprint(ans)', 'N, A, B = map(int, input().split())\nans = N // (A + B) * A\nrem = N % (A + B)\nans += min(rem, A)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s343964820', 's083748665']
[2940.0, 2940.0]
[17.0, 17.0]
[88, 106]
p02754
u694810977
2,000
1,048,576
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?
['n,a,b = map(int,input().split())\ndars = n // (a+b)*a\namari = n % (a+b)\ndars = min(amari,a)\nprint(dars)', 'n,a,b = map(int,input().split())\ndars = n // (a+b)*a\namari = n % (a+b)\ndars += min(amari,a)\nprint(dars)\n']
['Wrong Answer', 'Accepted']
['s138759439', 's035883680']
[2940.0, 2940.0]
[21.0, 18.0]
[102, 104]
p02754
u694951525
2,000
1,048,576
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?
['#include<bits/stdc++.h>\n\nusing namespace std;\n\nlong long n, a, b;\n\nint main(){\n\tcin >> n >> a >> b;\n\tcout << a*n/(a+b)+min(a, n%(a+b)) << endl;\n}', 'N, A, B = map(int, input().split())\nprint(N//(A+B)*A+min(A, N%(A+B)))']
['Runtime Error', 'Accepted']
['s496612531', 's130891255']
[2940.0, 3060.0]
[17.0, 19.0]
[145, 69]
p02754
u695079172
2,000
1,048,576
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?
['def main():\n s = input()\n q = int(input())\n hanten = False\n for i in range(q):\n query = input().split()\n if query[0] == "1":\n hanten = not hanten\n else:\n if query[1] == "1":\n if hanten:\n s = s + query[2]\n else:\n s = query[2] + s\n if query[1] == "2":\n if hanten:\n s = query[2] + s\n else:\n s = s + query[2]\n print(s if not hanten else s[::-1])\n\n\n\nif __name__ == \'__main__\':\n main()\n', "\ndef main():\n n,blue,red = map(int,input().split())\n total = blue+red\n answer = 0\n answer += (n // total) * blue\n amari = min(blue,(n % total))\n answer += amari\n print(answer)\n\n\n\n\nif __name__ == '__main__':\n main()\n\n"]
['Runtime Error', 'Accepted']
['s413372762', 's441108059']
[3060.0, 3064.0]
[18.0, 17.0]
[588, 240]
p02754
u695261159
2,000
1,048,576
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?
['if a == 0:\n print(0)\nelse:\n ans = (int(n / (a+b)) * a)\n if n % (a+b) > a:\n print(ans + a)\n else:\n print(ans + (n % (a+b)))', 'n,a,b,=map(int, input().split())\nif a == 0:\n print(0)\nelse:\n ans = (int(n / (a+b)) * a)\n if n % (a+b) > a:\n print(ans + a)\n else:\n print(ans + (n % (a+b)))']
['Runtime Error', 'Accepted']
['s988484679', 's452505578']
[2940.0, 2940.0]
[18.0, 17.0]
[148, 181]
p02754
u697696097
2,000
1,048,576
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?
['import sys\nfrom io import StringIO\nimport unittest\n\ndoTest=0\n\ndef yn(n):\n if n==1:\n print("Yes")\n else:\n print("No")\n return\n\ndef resolve():\n readline=sys.stdin.readline\n\n n,a,b=list(map(int, readline().strip().split()))\n #arr=list(map(int, readline().strip().split()))\n #n=int(readline().strip())\n #yn(n)\n ab = a+b\n if n <= ab:\n print(a)\n return\n t = n//ab\n print(t*a + min(n-t*ab, a))\n\n return', 'import sys\nfrom io import StringIO\nimport unittest\n\ndoTest=0\n\ndef yn(n):\n if n==1:\n print("Yes")\n else:\n print("No")\n return\n\ndef resolve():\n readline=sys.stdin.readline\n\n n,a,b=list(map(int, readline().strip().split()))\n #arr=list(map(int, readline().strip().split()))\n #n=int(readline().strip())\n #yn(n)\n ab = a+b\n\n if n <= a:\n print(n)\n return\n\n if n <= ab:\n print(a)\n return\n t = n//ab\n print(t*a + min(n-t*ab, a))\n\n return\n\nif doTest==0:\n resolve()\n sys.exit()']
['Wrong Answer', 'Accepted']
['s884158398', 's143840723']
[5960.0, 6388.0]
[139.0, 79.0]
[462, 555]
p02754
u699944218
2,000
1,048,576
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?
['N, A, B = list(map(int,input().split()))\nif A = 0:\n print(0)\nelif A >= N:\n print(N)\nelif A + B >= N:\n print(A)\nelse:\n print(N - B)', 'n, a, b = list(map(int, input().split()))\nif int(a) > int(n):\n print(int(n))\nelse:\n if int(a) + int(b) > int(n):\n print(int(a))\n else:\n print(int(a) + (int(n) % int(a)))', 'N, A, B = list(map(int,input().split()))\nif A == 0:\n print(0)\nelif A >= N:\n print(N)\nelif A + B >= N:\n print(A)\nelse:\n print(N//(A+B))', 'n, a, b = (int(x) for x in input().split())\nif a > n:\n print(n)\nelse:\n if a + b > n:\n print(a)\n else:\n print(a + (n % a))', 'N, A, B = list(map(int,input().split()))\nif A == 0:\n print(0)\nelif A >= N:\n print(N)\nelif A + B >= N:\n print(A)\nelse:\n print((N//(A+B))*A + min(A,N % (A+B)))']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s051938956', 's109948621', 's381228472', 's888868871', 's692949858']
[2940.0, 3064.0, 3060.0, 2940.0, 3060.0]
[17.0, 18.0, 17.0, 17.0, 24.0]
[134, 178, 138, 130, 161]
p02754
u703345769
2,000
1,048,576
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?
['N, A, B = [int(x) for x in input().split()]\nans = 0\nkake = 0\nAAA = 10 ** 18\n\nif A + B == N:\n ans = A\nelif N == 0:\n ans = 0\nelif A == 0:\n ans = 0\nelif B == 0:\n ans = N\nelif A + B > AAA:\n ans = 0\nelif N > AAA:\n ans = 0\nelse:\n kake = int(N / (A + B))\n mod = int(N/(A + B))\n if mod == 0:\n ans = A * kake\n else:\n ans = A * kake + A\n\nprint(ans)', 'N, A, B = [int(x) for x in input().split()]\n\nans = 0\nkake = 0\nif A + B == N:\n ans = A\nelif A == 0:\n ans = 0\nelse:\n kake = int(N / (A + B))\n mod = int(N/(A + B))\n if mod == 0:\n ans = A * kake\n else:\n ans = A * kake + A\n\nprint(ans)', 'N, A, B = [int(x) for x in input().split()]\nans = 0\nkake = 0\n\nif A + B == N:\n ans = A\nelif N == 0:\n ans = 0\nelif A == 0:\n ans = 0\nelif B == 0:\n ans = N\nelse:\n kake = int(N / (A + B))\n mod = int(N/(A + B))\n if mod == 0:\n ans = A * kake\n else:\n ans = A * kake + A\n\nprint(ans)', 'N, A, B = [int(x) for x in input().split()]\nans = 0\nkake = 0\nAAA = 10 ** 18\n\nif A + B == N:\n ans = A\nelif N == 0:\n ans = 0\nelif A == 0:\n ans = 0\nelif B == 0:\n ans = N\nelif A + B > AAA:\n ans = 0\nelif N > AAA:\n ans = 0\nelse:\n kake = int(N / (A + B))\n mod = int(N/(A + B))\n if mod == 0:\n ans = A * kake\n else:\n ans = A * kake + min(A, N - (N/(A-B))*(A+B))\n\nprint(ans)', 'N, A, B = [int(x) for x in input().split()]\n\nmod = int(N % (A + B))\nkake = int(N // (A + B))\nif mod <= A:\n print(kake*A + mod)\nelse:\n print(kake*A + A)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s099298564', 's210019288', 's215397446', 's508113130', 's785830001']
[3064.0, 3064.0, 3064.0, 3064.0, 2940.0]
[17.0, 17.0, 18.0, 17.0, 17.0]
[382, 261, 311, 408, 157]
p02754
u703528810
2,000
1,048,576
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?
['N,A,B=map(int,input().split())\n\nelif N%(A+B)<=A:\n print(N//(A+B)*A+N%(A+B))\nelse:\n print(N//(A+B)*A+A)', 'N,A,B=map(int,input().split())\n\nif N%(A+B)<=A:\n print(N//(A+B)*A+N%(A+B))\nelse:\n print(N//(A+B)*A+A)']
['Runtime Error', 'Accepted']
['s797113210', 's899588755']
[3064.0, 3064.0]
[18.0, 18.0]
[108, 106]
p02754
u703969935
2,000
1,048,576
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?
['N, B, R = map(int, input().split())\n\nans = (N // (B+R)) * B\nprint(ans)\n\n\nrest = N % (B+R)\n\nprint(rest)\n\nif rest < B:\n print(ans+rest)\nelse:\n print(ans+B) ', "N, B, R = map(int, input().split())\n\nLine = ''\n\nprint(N)\n\nwhile(N > len(Line)):\n for i in range(B):\n Line += 'b'\n for i in range(R):\n Line += 'r'\n\nans = Line[:N].count('b')\n\nprint(ans)", 'N, B, R = map(int, input().split())\n\nans = (N // (B+R)) * B\nrest = N % (B+R)\n\nif rest <= B:\n print(ans+rest)\nelse:\n print(ans+B) ']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s449852761', 's659027766', 's238263875']
[3060.0, 19348.0, 2940.0]
[18.0, 2108.0, 18.0]
[157, 192, 131]
p02754
u706330549
2,000
1,048,576
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?
['n, a, b = [int(x) for x in input().split()]\n\nif a == 0 and b == 0:\n print("0")\nelif a >= n:\n print(n)\nelse:\n x = n // (a + b)\n if x == 0:\n print(a)\n else:\n if (n - ((a + b) * x)) >= a:\n print(a * x + a)\n else:\n print((a + b) * x)\n', 'n, a, b = [int(x) for x in input().split()]\n\nif a == 0 and b == 0:\n print("0")\nelif a >= n:\n print(n)\nelse:\n x = n // (a + b)\n if x == 0:\n print(a)\n else:\n if (n - b * x) <= a:\n print(n - b * x)\n else:\n print(a * x + a)\n', 'n, a, b = map(int, input().split())\n\nq, r = divmod(n, (a + b))\n\nanswer = a * q + min(a, r)\nprint(answer)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s208830295', 's389331283', 's187509741']
[3064.0, 3060.0, 2940.0]
[19.0, 17.0, 17.0]
[288, 278, 104]
p02754
u709079466
2,000
1,048,576
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?
['n, a, b = map(int, input().split())\n\nans = n //(a+b) * a\nrem = n % (a+b)\nans += rem', 'n, a, b = map(int, input().split())\n\nans = n //(a+b) * a\nrem = n % (a+b)\nans += min(rem, a)\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s943883818', 's222214566']
[2940.0, 2940.0]
[17.0, 17.0]
[83, 114]
p02754
u709799578
2,000
1,048,576
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?
['n, a, b = map(int, input().split())\n\nc = n - 2 - 4\nprint(a + c)', 'n, a, b = map(int, input().split())\n\nq = n // (a + b)\nm = n % (a + b)\n\nif m <= a:\n print(q * a + m)\nelse:\n print(q * a + a)']
['Wrong Answer', 'Accepted']
['s667319797', 's442650886']
[3064.0, 2940.0]
[50.0, 17.0]
[63, 129]
p02754
u711238850
2,000
1,048,576
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?
['import math\nfrom collections import deque\ndef main():\n n,a,b = tuple([int(t)for t in input().split()])\n\n if b == 0:\n print(n)\n else:\n print(min(n,a))\n\nif __name__ == "__main__":\n main()', 'n,a,b = tuple(map(int,input().split()))\n\nans = n//(a+b)*a\n\nans += min(n%(a+b),a)\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s686216171', 's372022343']
[3700.0, 2940.0]
[87.0, 17.0]
[211, 92]
p02754
u713914478
2,000
1,048,576
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?
['N,B,R = map(int,input().split())\nk = N % (B + R)\nk2 = int(N / (B + R))\n#s = ("b"*B + "r"*R)\n\n#s1 = s[:k]\nif k >= B:\n\tprint(k2*(B) + k)\nelse:\n\tprint(k2*(B) + B)\n', 'N,B,R = map(int,input().split())\nk = N % (B + R)\nk2 = int(N / (B + R))\n#s = ("b"*B + "r"*R)\n\n#s1 = s[:k]\nif k <= B:\n\tprint(k2*(B) + k)\nelse:\n\tprint(k2*(B) + B)']
['Wrong Answer', 'Accepted']
['s466292679', 's819208129']
[2940.0, 2940.0]
[20.0, 18.0]
[160, 159]
p02754
u715355213
2,000
1,048,576
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?
['N,A,B = map(int,input().split())\n\nif A == 0:\n print(0)\nelse:\n if N > A+B:\n a = N / (A+B)\n b = N % (A+B)\n if b > A:\n b = A\n print(a*A + b)\n else:\n if A > N:\n print(N)\n else:\n print(A)', 'N,A,B = map(int,input().split())\n\nif A == 0:\n print(0)\nelse:\n if N > A+B:\n a = N // (A+B)\n b = N % (A+B)\n if b > A:\n b = A\n print(a*A + b)\n else:\n if A > N:\n print(N)\n else:\n print(A)\n ']
['Wrong Answer', 'Accepted']
['s130709902', 's363824718']
[3060.0, 3060.0]
[18.0, 18.0]
[266, 280]
p02754
u718411265
2,000
1,048,576
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?
['N,A,B=list(map(int,input().split()))\na=N//(A+B)*A\nprint(a)', 'N,A,B=list(map(int,input().split()))\na=N//(A+B)*A\nif N==A+B:\n print(a)\nelse:\n print(a+min(N%(A+B),A))']
['Wrong Answer', 'Accepted']
['s924988042', 's966937841']
[3064.0, 3064.0]
[18.0, 17.0]
[58, 103]
p02754
u718949306
2,000
1,048,576
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?
['N, A, B = map(int, input().split())\nC = 0\nwhile True:\n if N <= 0:\n break\n if A > 0:\n if N - A <= 0:\n print(N)\n break\n else:\n C = C + A\n N = N - A \n else:\n print(0)\n break\n N = N - B\nprint(C)', 'N, A, B = map(int, input().split())\nans = N // (A + B) * A\nrem = N % (A + B)\nans += min(rem, A)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s627219512', 's356396784']
[2940.0, 2940.0]
[2104.0, 17.0]
[282, 106]
p02754
u719238648
2,000
1,048,576
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?
['a,b,c=input().strip().split(" ")\na,b,c=[int(a),int(b),int(c)]\np=b+c\nx=a//p\nm=a%p\npp=min(b,m)\nprint(pp+x*a)', 'a,b,c=input().strip().split(" ")\na,b,c=[int(a),int(b),int(c)]\np=b+c\nx=a//p\nm=a%p\npp=min(b,m)\nprint(pp+x*b)\n']
['Wrong Answer', 'Accepted']
['s364346082', 's136824876']
[3068.0, 2940.0]
[19.0, 17.0]
[106, 107]
p02754
u721425712
2,000
1,048,576
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?
['# B\nn, a, b = map(int, input().split())\n\nif n <= a+b:\n if n >= a:\n print(a)\n elif n < a:\n print(n)\nelif n > a+b:\n ans = (n//(a+b))*a\n if n-ans >= a:\n print(ans+a)\n elif n < a:\n print(ans+n)', '# B\nn, a, b = map(int, input().split())\n\nif n <= a+b:\n if n >= a:\n print(a)\n elif n < a:\n print(n)\nelif n > a+b:\n ans = (n//(a+b))*a\n if n-ans >= a:\n print(ans+a)\n elif n-ans < a:\n print(ans+n)', '# B\nn, a, b = map(int, input().split())\n\nif n <= a+b:\n if n >= a:\n print(a)\n elif n < a:\n print(n)\nelif n > a+b:\n taba = n//(a+b)\n if n-taba*(a+b) >= a:\n print(taba*a+a)\n elif n-taba*(a+b) < a:\n print(taba*a+n)', '# B\nn, a, b = map(int, input().split())\n\nif n <= a+b:\n if n >= a:\n print(a)\n elif n < a:\n print(n)\nelif n > a+b:\n taba = n//(a+b)\n if n-taba*(a+b) >= a:\n print(taba*a+a)\n elif n-taba*(a+b) < a:\n print(taba*a+n-taba*(a+b))']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s053990170', 's062744214', 's606193172', 's571250841']
[3064.0, 3060.0, 3060.0, 3060.0]
[18.0, 17.0, 18.0, 17.0]
[232, 236, 253, 264]
p02754
u723583932
2,000
1,048,576
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?
['n,a,b=map(int,input().split())\nans=0\nif a==0:\n ans=0\nelif b==0:\n ans=n\nelif n>(a+b):\n ans=a*(n//(a+b))\n n=n%(a+b)\nelse:\n while True:\n if n==0:\n break\n if n-a>=0:\n n-=a\n ans+=a\n else:\n ans+=n\n break\n n-=b\n if n<=0:\n break\nprint(ans)\n', '\nn,a,b=map(int,input().split())\nans=0\nif a+b>=2:\n ans=n//(a+b)\nelif a==0:\n ans=0\nelif b==0:\n ans=n\nelif n%(a+b)-b<0:\n ans+=n%(a+b)\nelse:\n ans+=n%(a+b)-b\nprint(ans)\n', 'n,a,b=map(int,input().split())\nans=n//(a+b)\nif a==n:\n ans=n\nelif a==0:\n ans=0\nelif n%(a+b)-b<0:\n ans+=n%(a+b)\nelse:\n ans+=n%(a+b)-b\nprint(ans)\n', '#abc 158 b\n\nn,a,b=map(int,input().split())\nans=0\nif a+b>=2:\n ans=n//(a+b)\nelif a==0:\n ans=0\nelif b==0:\n ans=n\nelif n%(a+b)-b<0:\n ans+=n%(a+b)\nelse:\n ans+=n%(a+b)-b\nprint(ans)\n', 'n,a,b=map(int,input().split())\nans=0\nif a==0:\n ans=0\nelif b==0:\n ans=n\nelif n>(a+b):\n ans=a*(n//(a+b))\n n=n%(a+b)\nelse:\n while True:\n if n-a>=0:\n n-=a\n ans+=a\n else:\n ans+=n\n break\n n-=b\n if n<=0:\n break\nprint(ans)', 'n,a,b=map(int,input().split())\nans=0\nif a==0:\n ans=0\nelif b==0:\n ans=n\nelse:\n ans=a*(int(n/(a+b)))\n n=n%(a+b)\n while True:\n if n==0:\n break\n if n-a<0:\n ans+=n\n break\n else:\n ans+=a\n break\n\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s059520943', 's143148701', 's230720553', 's929819524', 's944147933', 's583730649']
[3060.0, 3060.0, 2940.0, 3060.0, 3064.0, 3064.0]
[18.0, 18.0, 18.0, 18.0, 18.0, 18.0]
[348, 179, 155, 287, 312, 290]
p02754
u725993280
2,000
1,048,576
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?
['n,a,b = map(int,input().split())\n\n n//(a+b)\n\nsum = 0\nif n >= a:\n while(n > a):\n n = n-a-b\n sum += a\n print(sum+n)\nelse:\n print(n)', 'n,a,b = map(int,input().split())\n\nsum = n//(a+b)*a\nres = n%(a*b)\nsum += min(res,a)\n\nprint(sum)', 'n,a,b = map(int,input().split())\n\nsum = 0\nif n >= a:\n while(n > a):\n n = n-a-b\n sum += a\nprint(sum+n)\nelse:\n print(a)', 'n = int(input())\na = int(input())\nb = int(input())\n\nsum = 0\n\nwhile(n > a):\n n = n-a-b\n sum += a\n\nprint(sum+n)', 'n,a,b = map(int,input().split())\n\nsum = n//(a+b)*a\nres = n%(a+b)\nsum += min(res,a)\n\nprint(sum)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s183974499', 's349817405', 's640122090', 's960726860', 's869129536']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 18.0, 18.0]
[152, 94, 137, 115, 94]
p02754
u726285999
2,000
1,048,576
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?
['N, A, B = map(int, input().split())\n\nx = N // (A+B)\ny = N % (A+B)\nif A < y:\n sum = A*X + A\nelse:\n sum = A*X + y\nprint(sum)', 'N, A, B = map(int, input().split())\n \nx = N // (A+B)\ny = N % (A+B)\nsum = A*x + min(A, y)\nprint(sum)']
['Runtime Error', 'Accepted']
['s253859091', 's003557456']
[3060.0, 2940.0]
[17.0, 17.0]
[124, 99]
p02754
u728483880
2,000
1,048,576
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?
['n,a,b=input().split()\n\ntmp1,tmp2=divmod(N,a+b)\n\nblue=tmp1*a\nif(tmp2>a):\n blue=blue+a\neles:\n blue=blue+tmp2\n \nprint("blue")', 'n,a,b=map(int,input().split())\n\ntmp1,tmp2=divmod(n,a+b)\n\nblue=tmp1*a\nif(tmp2>a):\n blue=blue+a\nelse:\n blue=blue+tmp2\n \nprint(blue)']
['Runtime Error', 'Accepted']
['s657824353', 's515294913']
[2940.0, 2940.0]
[17.0, 18.0]
[125, 132]
p02754
u729008627
2,000
1,048,576
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?
['N, A, B = map(int, input().split())\nlen_loop = A + B\nn_comp_loop = N//len_loop\nblue_res = max(A, N % len_loop)\nprint(n_comp_loop * A + blue_res)\n', 'N, A, B = map(int, input().split())\nlen_loop = A + B\nn_comp_loop = N//len_loop\nblue_res = min(A, N % len_loop)\nprint(n_comp_loop * A + blue_res)\n']
['Wrong Answer', 'Accepted']
['s717887902', 's588327482']
[2940.0, 2940.0]
[17.0, 17.0]
[145, 145]
p02754
u729133443
2,000
1,048,576
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?
['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))']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s121872912', 's131813667', 's406622816', 's532717601', 's727969795']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 18.0, 17.0]
[56, 69, 69, 62, 60]
p02754
u730107446
2,000
1,048,576
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?
['n,a,b=map(int, input().split())\ncount=n//a+b*a\nn=n%(a+b)\ncount+=min(n,a)\nprint(count)\n', 'n,a,b=map(int, input().split())\ncount=n//(a+b)*a\nn=n%(a+b)\ncount+=min(n,a)\nprint(count)']
['Runtime Error', 'Accepted']
['s524418069', 's295260969']
[2940.0, 2940.0]
[17.0, 17.0]
[86, 87]
p02754
u730270108
2,000
1,048,576
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?
['n, a, b = list(map(int, input().split()))\nresult = 0\nif a + b != 0:\n roop = n // (a +b)\n extra = n - roop*(a+b)\n print(extra)\n result = a*roop\n if extra >= a:\n result += a\n else:\n result += extra\nprint(result)', 'n, a, b = list(map(int, input().split()))\nresult = 0\nif a + b != 0:\n roop = n // (a +b)\n extra = n - roop*(a+b)\n result = a*roop\n if extra >= a:\n result += a\n else:\n result += extra\nprint(result)']
['Wrong Answer', 'Accepted']
['s007354565', 's082796605']
[3060.0, 3060.0]
[18.0, 18.0]
[221, 206]
p02754
u731322489
2,000
1,048,576
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?
['n, a, b = map(int, input().split())\nprint(n, a, b)\n\nans = 0\nif a > 0:\n ans += (a * (n // (a + b)))\n if (n % (a + b)) >= a:\n ans += a\n else:\n ans += (n % (a + b))\nprint(ans)', 'n, a, b = map(int, input().split())\nprint(n, a, b)\n\nans = 0\nif a > 0:\n ans += (a * (n // (a + b)))\n if 0 < (n % (a + b)) < a:\n ans += (n % (a + b))\n else:\n ans += a\nprint(ans)', 'n, a, b = map(int, input().split())\nprint(n, a, b)\n\nans = 0\nif a > 0:\n ans = a * (n // (a + b)) + (n % (a + b)) if (n % (a + b)) < a else a\nprint(ans)', 'n, a, b = map(int, input().split())\nprint(n, a, b)\n\nans = 0\nif a > 0:\n ans += (a * (n // (a + b)))\n if (n % (a + b)) > a:\n ans += a\n else:\n ans += (n % (a + b))\nprint(ans)', 'n, a, b = map(int, input().split())\nprint(n, a, b)\n\nans = 0\nif a > 0:\n ans += a * (n // (a + b))\n if 0 < n % (a + b) < a:\n ans += n % (a + b)\n else:\n ans += b\nprint(ans)', 'n, a, b = map(int, input().split())\nprint(n, a, b)\n\nans = 0\nif a > 0:\n ans += a * (n // (a + b))\n if 0 < n % (a + b) < a:\n ans += n % (a + b)\n else:\n ans += a\nprint(ans)\n', 'n, a, b = map(int, input().split())\nans = 0\nif a > 0:\n ans += (a * (n // (a + b)) + min(n % (a + b), a))\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s061824792', 's092348399', 's220932193', 's759982867', 's855987197', 's876309759', 's878300001']
[3060.0, 3060.0, 3060.0, 3060.0, 3060.0, 3060.0, 2940.0]
[17.0, 17.0, 18.0, 17.0, 17.0, 19.0, 17.0]
[195, 198, 153, 194, 192, 193, 118]
p02754
u733465500
2,000
1,048,576
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?
['N, A, B = map(int,input().split())\nAB = A + B\nn = N//AB\nprint(n*A)', 'import sys\nN, A, B = map(int,input().split())\nAB = A + B\nn = N//AB\namari = N%AB\nif A >= N:\n print(N)\n sys.exit()\nif AB > N:\n print(A)\n sys.exit()\nadd = min(amari, A)\nprint(n*A + add)']
['Wrong Answer', 'Accepted']
['s369619566', 's209598879']
[2940.0, 3060.0]
[17.0, 17.0]
[66, 186]
p02754
u733581231
2,000
1,048,576
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?
['n, a,b = map(int, input().split())\nans = n//(a+b)\nrem = n%(a+b)\nans+=min(a,rem)\nprint(ans)', 'import math\nn , a , b = map(int, input().split())\nif a >= n : exit(print(n))\nans = n/(a+b)\nprint(math.floor(ans*a))', 'import math\nn , a , b = map(int, input().split())\nif a >- n : exit(print(n))\nans = n/(a+b)\nprint(math.ceil(ans*a))', 'n, a,b = map(int, input().split())\nans = n//(a+b)*a\nrem = n%(a+b)\nans+=min(a,rem)\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s184861558', 's668982485', 's923502930', 's435582930']
[2940.0, 3060.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[90, 116, 115, 92]
p02754
u735335967
2,000
1,048,576
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?
['n, b, r = map(int, input().split())\nb1 = n//(b+r)\nb2 = n % (b+r)\nif b == 0:\n print(0)\nelif n % (b+r) != 0:\n b1 = b1*b + b\n print(b1)\nelif n % (b+r) == 0:\n print(b1*b)\n', 'n, b, r = map(int, input().split())\nb1 = n//(b+r)\nb2 = n % (b+r)\nif b == 0:\n print(0)\nelif r == 0:\n print(n)\nelif b2 != 0 and b2 <= b:\n b1 = b1*b + b2\n print(b1)\nelif b2 != 0 and b2 > b:\n b1 = b1*b + b\n print(b1)\nelif n % (b+r) == 0:\n print(b1*b)\n']
['Wrong Answer', 'Accepted']
['s741582553', 's029657453']
[3060.0, 3060.0]
[18.0, 19.0]
[179, 268]
p02754
u746154235
2,000
1,048,576
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?
['N,A,B=map(int, input().split())\nlen=A+B\nprint((N / len)* A + min(A, N % len))\n', 'N,A,B=map(int, input().split())\nlen=A+B\nprint((N // len)* A + min(A, N % len))\n']
['Wrong Answer', 'Accepted']
['s157973469', 's478474792']
[2940.0, 3060.0]
[17.0, 18.0]
[78, 79]
p02754
u749686470
2,000
1,048,576
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?
['n,a,b=map(int,input().split())\ntemp1=n//(a+b)\ntemp=n-temp1\nans=min(a,temp)\nans+=(temp1*a)\nprint(ans)\n', 'n,a,b=map(int,input().split())\ntemp1=n//(a+b)\ntemp=n-temp1\nans=min(a,temp)\nans+=(temp1*a)\nprint(ans)\n', 'n,a,b=map(int,input().split())\ntemp1=n//(a+b)\ntemp=n-(temp1*(a+b))\nans=min(a,temp)\nans+=(temp1*a)\nprint(ans)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s307344576', 's742340028', 's834457249']
[2940.0, 2940.0, 2940.0]
[17.0, 18.0, 18.0]
[101, 101, 109]
p02754
u750120744
2,000
1,048,576
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?
["n, a, b = map(int, input().split())\nbox = []\nans = []\n\nwhile n > len(box):\n box1 = [('b') for _ in range(a)]\n box2 = [('r') for _ in range(b)]\n box.extend(box1)\n box.extend(box2)\n \nm = n - len(box)\n\nif m < 0:\n del box[m:]\n\nprint(box, box.count('b'))", 'n, a, b = map(int, input().split())\n\nc = n // (a + b)\nd = n - (a+b) * c\nans = a * c\n\nif a > d:\n ans += d\nelse:\n ans += a\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s252940797', 's444715502']
[531480.0, 3060.0]
[2132.0, 18.0]
[267, 138]
p02754
u751539777
2,000
1,048,576
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?
['n, a, b = map(int, input().split())\n\nans = n // (a + b)\nans *= a\n\nprint(ans)', 'n, a, b = map(int, input().split())\n\nans = n // (a + b)\nans *= a\n\nif n % (a + b) != 0:\n ans += min(a, n % (a + b))\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s302330095', 's801426670']
[2940.0, 2940.0]
[17.0, 17.0]
[76, 128]
p02754
u753635524
2,000
1,048,576
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?
["import sys\n\nN,A,B = map(int,input().split(' '))\n\nCount_Blue = 0\nif 1<=N<=10**18 and A > 0 and B >= 0 and \\\n 0< A + B <= 10**18:\n Add_Blue = 1 * A\n Add_Both = Add_Blue + 1 * B\n\n q = N // Add_Both\n mod = N % Add_Both\n if mod < Add_Blue:\n Count_Blue = (q *Add_Blue) + mod\n print(Count_Blue)\n else:\n Count_Blue = (q * Add_Blue) + Add_Blue\n print(Count_Blue)\nelif A == 0:\n print(Count_Blue)", "import sys\n\nN,A,B = map(int,input().split(' '))\n\nCount_Blue = 0\nif 1<=N<=10**18 and A > 0 and B >= 0 and \\\n 0< A + B <= 10**18:\n Add_Blue = 1 * A\n Add_Both = Add_Blue + 1 * B\n\n q = N // Add_Both\n mod = N % Add_Both\n if mod < Add_Blue:\n Count_Blue = (q *Add_Blue) + mod\n else:\n Count_Blue = (q * Add_Blue) + Add_Blue\n print(Count_Blue)\nelif A == 0:\n print(Count_Blue)"]
['Wrong Answer', 'Accepted']
['s196504909', 's699296138']
[3064.0, 3064.0]
[17.0, 17.0]
[432, 406]
p02754
u756988562
2,000
1,048,576
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?
['n,a,b = map(int,input().split())\nif a>n:\n print(a)\nans = 0\nelse:\n temp = N//(a+b)\n ans = temp*a\n temp2 = N- temp\n if temp2 < a:\n print(ans+temp2)\n else:\n print(ans+a)', 'n,a,b = map(int,input().split())\ntemp = n//(a+b)\nans = temp*a\ntemp2 = n%(a+b)\nprint(ans+min(temp2,a)) ']
['Runtime Error', 'Accepted']
['s497082049', 's613409310']
[2940.0, 2940.0]
[17.0, 17.0]
[178, 102]
p02754
u757274384
2,000
1,048,576
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?
['n,a,b = map(int,input().split())\n\nk = n//(a+b) + \nL = ["b"]*a +["r"]*b\nL = L*k\nprint(L[0:n+1].count("b"))', 'n,a,b = map(int, input().split())\n\nx = n//(a+b)\ny = n % (a+b)\n\nif y <= a:\n print(a * x + y)\nelse:\n print(a*x + a)']
['Runtime Error', 'Accepted']
['s275727675', 's653839734']
[2940.0, 2940.0]
[17.0, 17.0]
[105, 115]
p02754
u762540523
2,000
1,048,576
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?
['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))']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s098308225', 's436942138', 's568635750', 's848588721', 's960722395']
[2940.0, 2940.0, 3060.0, 2940.0, 2940.0]
[17.0, 18.0, 19.0, 20.0, 18.0]
[61, 52, 61, 52, 63]
p02754
u763177133
2,000
1,048,576
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?
["a8, a10 = input().split(' ')\na8 = int(a8)\na10 = int(a10)\n \nvalue1 = int(a8 / 0.08)\nvalue2 = int(a10 / 0.1)\n\nif int(value1 * 0.1) == a10:\n if value1 > value2:\n print(value1)\n else:\n print(value2)\nelif int(value2 * 0.08 == a8):\n if value1 > value2:\n print(value1)\n else:\n print(value2)\nelse:\n print(-1)", "s = input()\nn, a, b = s.split(' ')\nn = int(n)\na = int(a)\nb = int(b)\nna = n / (a+b) * a \nif n % (a+b) >= a :\n na += a\nelse:\n na += n % (a+b)\n \nprint(na)", 'N,A,B = map(int, input().split())\n\ni = N // (A+B)\nb = i*A\nt = N % (A+B)\n\nif t > A:\n t = A\n \nprint(b+t)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s125968523', 's672448162', 's083126578']
[3064.0, 3060.0, 9080.0]
[20.0, 17.0, 29.0]
[317, 154, 104]
p02754
u766413013
2,000
1,048,576
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?
['N, A, B = map(int, input().split())\n2 ans = N // (A + B) * A\n3 rem = N % (A + B)\n4 ans += min(rem, A)\n5 print(ans)', 'N, A, B = map(int, input().split())\nans = N // (A + B) * A\nrem = N % (A + B)\nans += min(rem, A)\nprint(ans)']
['Runtime Error', 'Accepted']
['s731907168', 's521189658']
[2940.0, 2940.0]
[17.0, 17.0]
[114, 106]
p02754
u766566560
2,000
1,048,576
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?
["N, A, B = map(int, input().split())\nblue = 'b' * A\nred = 'r' * B\nstr = ''\n\nfor _ in range(N):\n for i in range(A):\n if len(str) < N:\n str += blue\n for j in range(B):\n if len(str) < N:\n str += red\n\nprint(str.count('b'))", 'N, A, B = map(int, input().split())\nprint((N // (A + B) * A) + min(A, N % (A + B)))']
['Runtime Error', 'Accepted']
['s865177269', 's251528792']
[1917972.0, 3064.0]
[2263.0, 18.0]
[235, 83]
p02754
u768256617
2,000
1,048,576
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?
['n,a,b=map(int,input().split())\nif n%(a+b)>=a:\n s=a\n \nelse:\n s=n%(a+b)\nprint(n//(a+b)+s)', 'n,a,b=map(int,input().split())\nif n%(a+b)>=a:\n s=a\n \nelse:\n s=n%(a+b)\nprint(n//(a+b)*a+s)']
['Wrong Answer', 'Accepted']
['s158677173', 's771864827']
[2940.0, 2940.0]
[18.0, 17.0]
[90, 92]
p02754
u769870836
2,000
1,048,576
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?
['a,b,c=map(int,input().split())\nif b==0:\n print(0)\nelse:\n print(a//(b+c)+a%(b+c))', 'a,b,c=map(int,input().split())\nif b==0:\n print(0)\nelse:\n print(b*(a//(b+c))+min(b,a%(b+c)))']
['Wrong Answer', 'Accepted']
['s522846286', 's984065333']
[3064.0, 2940.0]
[17.0, 17.0]
[82, 93]
p02754
u773440446
2,000
1,048,576
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?
['n,a,b = map(int,input().split())\nans = 0\nq = n // (a+b)\nprint(q)\nans += q*a\nq = n - (a+b)*q\nprint(q)\nif q - a >= 0:\n ans += a\nif q - a < 0:\n ans = ans + a +(q-a)\nprint(ans)', 'n,a,b = map(int,input().split())\nans = 0\nq = n // (a+b)\n\nans += q*a\nq = n - (a+b)*q\n\nif q - a >= 0:\n ans += a\nif q - a < 0:\n ans = ans + a +(q-a)\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s877280520', 's957455781']
[9132.0, 9088.0]
[29.0, 29.0]
[178, 163]
p02754
u777028980
2,000
1,048,576
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?
['n,a,b=map(int,input().split())\n\nans=n//(a+b)\nans=a*ans\nhoge=n%(a+b)%1\nif(hoge>a):\n ans+=hoge-a\nelse:\n ans+=hoge\n\nprint(int(ans))', 'n,a,b=map(int,input().split())\n\nans=n//(a+b)\nans=a*ans\nhoge=n%(a+b)\nif(hoge>a):\n ans+=a\nelse:\n ans+=hoge\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s550386572', 's818713831']
[3060.0, 3060.0]
[17.0, 17.0]
[130, 118]
p02754
u777241657
2,000
1,048,576
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?
['a,b,c=input().split()\n\nif a==b+c:\n print(b)\nelif b==0:\n print(0)\nelse:\n print(a-c+b)', 'S,a,b=(int(x) for x in input().split())\nans = S//(a+b) * a\nrem = S % (a+b )\nans +=min(rem,a)\nprint(ans)']
['Runtime Error', 'Accepted']
['s351016409', 's516481822']
[2940.0, 2940.0]
[18.0, 17.0]
[87, 103]
p02754
u789836448
2,000
1,048,576
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?
['import sys\n\nread = sys.stdin.readline\nT = read()\na, b, c = map(int, T.split())\n\ntemp = a // (b+c)\nanswer = temp * b\ntemp2 = a % (b+c)\n\nif temp2 >= b:\n answer += b\nelse:\n answer += temp2\n\nprint(temp2) \n\n', 'import sys\n\nread = sys.stdin.readline\nT = read()\na, b, c = map(int, T.split())\n\nif b == 0:\n print(0)\nelse if b == 8:\n print(8)\nelse:\n print(a-c)', 'import sys\n\nread = sys.stdin.readline\nT = read()\na, b, c = map(int, T.split())\n\ntemp = a // (b+c)\nanswer = temp * b\ntemp2 = a % (b+c)\n\nif temp2 >= b:\n answer += b\nelse:\n answer += temp2\n\nprint(answer) \n\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s626740547', 's896760429', 's708104223']
[2940.0, 2940.0, 2940.0]
[18.0, 18.0, 18.0]
[208, 153, 209]
p02754
u790493075
2,000
1,048,576
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?
['n, b, r = map(int,input().split())\n\nrep = n // (a+b)\nmod = n % (a+b)\nans = rep * b\n\nif mod > a:\n\tans+= a \nelse:\n ans+= mod\nprint(ans)', 'n, b, r = map(int,input().split())\n \nrep = n // (b+r)\nmod = n % (b+r)\nans = rep * b\n \nif mod > b:\n\tans+= b \nelse:\n ans+= mod\nprint(ans)']
['Runtime Error', 'Accepted']
['s477847002', 's013458438']
[2940.0, 2940.0]
[18.0, 17.0]
[137, 139]
p02754
u796708718
2,000
1,048,576
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?
['N, A, B = [int(x) for x in input().split(" ")]\n\nif A == 0:\n print(0)\nelif N%(A+B) == 0:\n print(int(N/(A+B))*A)\nelse:\n print(int(N/(A+B))*A+int(min(N%A+B,A)))', 'N, A, B = [int(x) for x in input().split(" ")]\n\nprint(int(N/(A+B))*A)+int(min(N%(A+B),A))\n', 'N, A, B = [int(x) for x in input().split(" ")]\n\n\nif N%(A+B) == 0:\n print(int(N/(A+B))*A)\nelse:\n print(int(N/(A+B))*A)+int(min(N%(A+B),A))\n', 'N, A, B = [int(x) for x in input().split(" ")]\n\nprint(int(N/(A+B))*A+int(min(N%(A+B),A)))']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s347136991', 's399120983', 's796082098', 's949220887']
[3060.0, 2940.0, 3060.0, 2940.0]
[19.0, 18.0, 18.0, 17.0]
[161, 91, 141, 90]
p02754
u796842765
2,000
1,048,576
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?
['N, A, B = map(int, input().split())\nF = A + B\nC = N / F\nD = N % C\nE = A * C\nif A == 0:\n print(0)\nelif B == 0:\n print(A)\nelif C == 0:\n if N < A:\n print(N)\n else:\n print(A)\nelse:\n if D < A:\n print(E + D)\n else:\n print(E + A)\n ', 'N, A, B = map(int, input().split())\nF = A + B\nC = N // F\nD = N % C\nE = A * C\nif A == 0:\n print(0)\nelif B == 0:\n print(A)\nelif C == 0:\n if N < A:\n print(N)\n else:\n print(A)\nelse:\n if D < A:\n print(E + D)\n else:\n print(E + A)\n \n', 'N, A, B = map(int, input().split())\nF = A + B\nC = N // F\nD = N % C\nE = A * C\nif A == 0:\n print(0)\nelif B == 0:\n if A > N:\n print(A - N)\n else:\n print(N)\nelif C == 0:\n if N < A:\n print(N)\n else:\n print(A)\nelse:\n if D < A:\n print(E + D)\n else:\n print(E + A)\n \n', 'N, A, B = map(int, input().split())\nC = N // (A + B) * A + N % (A + B)\nD = N // (A + B) * A + A\nif A == 0:\n print(0)\nelif B == 0:\n print(N)\nelif N % (A + B) > A:\n print(D)\nelse:\n print(C)']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s545515185', 's632749315', 's904157663', 's075254881']
[3060.0, 3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0, 17.0]
[243, 245, 284, 199]
p02754
u799428010
2,000
1,048,576
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?
['N,A,B=map(int,input().split())\nN, A, B = map(int, input().split())\nans = N // (A + B) * A\nrem = N % (A + B)\nans += min(rem, A)\nprint(ans)', 'N, A, B = map(int, input().split())\nans = N // (A + B) * A\nrem = N % (A + B)\nans += min(rem, A)\nprint(ans)']
['Runtime Error', 'Accepted']
['s321273871', 's217690027']
[9180.0, 9076.0]
[26.0, 29.0]
[137, 106]
p02754
u806976856
2,000
1,048,576
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?
['n,a,b=map(int,input().split())\nx=n/(a+b)-n%(a+b)\nc=n-(a+b)*x\nprint(int(a*x+min(c,a)))', 'n,a,b=map(int,input().split())\nx=n//(a+b)\nc=n-(a+b)*x\nprint(int(a*x+min(c,a)))\n']
['Wrong Answer', 'Accepted']
['s443229586', 's301975832']
[2940.0, 2940.0]
[17.0, 18.0]
[85, 79]
p02754
u812867074
2,000
1,048,576
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?
['n,a,b = map(int,input().split())\ns = a+b\nc = n % s\nd = n // s\n\nif c <= a:\n print( a*d + s )\n\nelse:\n print( a*d + a )\n \n', 'n,a,b = map(int,input().split())\ns = a+b\nc = n % s\nd = n // s\n\nif s <= a:\n print( a*d + s )\n\nelse:\n print( a*d + a )\n ', 'n,a,b = map(int,input().split())\ns = a+b\nc = n % s\nd = n // s\n\nif c <= a:\n print( a*d + c )\n\nelse:\n print( a*d + a )']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s435554189', 's775241756', 's399841851']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[122, 121, 118]
p02754
u813993459
2,000
1,048,576
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?
['n,a,b=map(int, input().split())\ntmp = 0\nif n%a+b>a:\n tmp = a\nelse:\n tmp = 0\nprint((n//(a+b))*a+tmp)', 'n,a,b=map(int, input().split())\n(n//(a+b))*a+n%(a+b)', 'n,a,b=map(int, input().split())\ntmp = 0\nif n%a+b>a:\n tmp = a\nelse\n tmp = n%a+b\nprint((n//(a+b))*a+tmp)', 'n,a,b=map(int, input().split())\ntmp = n%(a+b)\nif tmp>a:\n tmp = a\nprint((n//(a+b))*a+tmp)']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s092260806', 's146592415', 's641572045', 's213366951']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[105, 52, 108, 91]
p02754
u816631826
2,000
1,048,576
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?
['n, a, b = list(map(int, input().split()))\nprint( (n // (a+b)) * a + abs((n % (a+b)) - a))', 'n=input()\ni=0\na=input()\nb=input()\nc=0\nwhile True:\n for j in range(a):\n if i >= n:break\n i+=1\n c+=1\n for j in range(b):\n i+=1\n if i > n:break\nprint(c)\n', 'def count_balls(n, a, b):\n if(a==0): return 0\n if(n<a): return n\n end = n % (a+b)\n if(end > a):\n return a*(n//(a+b))+a\n else:\n return a*(n//(a+b))+end\nn,a,b=map(int, input().strip().split())\nprint(count_balls(n,a,b))']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s418416972', 's567702569', 's819606143']
[2940.0, 3060.0, 3060.0]
[17.0, 18.0, 17.0]
[89, 187, 245]
p02754
u820284192
2,000
1,048,576
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?
['N, A, B = map(int, input().split())\n \ntmp1 = N // (A + B)\ntmp2 = N % (A + B)\n \nprint(tmp1 * A + mim(tmp2, A))', 'N, A, B = map(int, input().split())\n \ntmp1 = N // (A + B)\ntmp2 = N % (A + B)\n \nprint(tmp1 * A + min(tmp2, A))']
['Runtime Error', 'Accepted']
['s661364255', 's364788445']
[2940.0, 2940.0]
[17.0, 17.0]
[109, 109]
p02754
u821775079
2,000
1,048,576
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?
['N,A,B=map(int,input().split())\n\nope=10**100\n\namari=ope % (A+B)\n\nao=min(amari,A)\nao+=(N-amari)//(A+B)*A\nif (N-amari)%(A+B) > B:\n ao+=(N-amari)%(A+B)-B\n\nprint(ao)', 'N,A,B=map(int,input().split())\n\nans=N//(A+B)*A + min(N%(A+B),A)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s783206066', 's984483083']
[3064.0, 2940.0]
[19.0, 19.0]
[163, 74]
p02754
u821823292
2,000
1,048,576
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?
['N,A,B=map(int(),input().split())\nK=A*int(N/(A+B))\namari=N%(A+B)\ni=1\nwhile ((amari-i)>0):\n i=i+1\nK=K+i\nprint(K)', 'N,A,B=map(int(),input().split())\nK=A*int(N/(A+B))\namari=N%(A+B)\ni=1\nwhile ((amari-i)>0):\n i=i+1\nK=K+i\n ', 'N,A,B=map(int,input().split())\nK=A*int(N/(A+B))\namari=N%(A+B)\nif (amari>=A):\n i=A\nelif (amari<A):\n i=amari\nK=K+i\nprint(K)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s052025734', 's928800632', 's205117116']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[111, 105, 123]
p02754
u823885866
2,000
1,048,576
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?
['import sys\nn, a, b = map(int, sys.stdin.readline().split())\nballs = n * a / (a+b)\nif n % (a+b) <= a:\n balls += n % (a+b)\nelse:\n balls += a\nprint(balls)', 'import sys\nn, a, b = map(int, sys.stdin.readline().split())\nballs = n // (a+b) * a\nif n % (a+b) <= a:\n balls += n % (a+b)\nelse:\n balls += a\nprint(balls)\n']
['Wrong Answer', 'Accepted']
['s793301070', 's120963712']
[2940.0, 2940.0]
[17.0, 18.0]
[153, 155]
p02754
u827021590
2,000
1,048,576
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?
['# -*- coding: utf-8 -*-\ni_str = input()\nN,A,B = map(int,i_str.split())\n\nimport sys\nAB = A+B\nmaxnum = pow(10,100)\nif A == 0:\n print(0)\n sys.exit()\nif N <= A:\n print(N)\n sys.exit()\nwaru,amari = divmod(B,AB)\n\n#amari = N % AB\nif amari > A:\n amari = A\nanswer = waru * A + amari\n\nprint(answer)', '# -*- coding: utf-8 -*-\ni_str = input()\nN,A,B = map(int,i_str.split())\n\nimport sys\nAB = A+B\nmaxnum = pow(10,100)\nif A == 0:\n print(0)\n sys.exit()\nif N <= A:\n print(N)\n sys.exit()\nwaru,amari = divmod(N,AB)\n\n#amari = N % AB\nif amari > A:\n amari = A\nanswer = waru * A + amari\nprint(answer)']
['Wrong Answer', 'Accepted']
['s180226319', 's977020116']
[3064.0, 3064.0]
[19.0, 17.0]
[319, 318]
p02754
u830087664
2,000
1,048,576
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?
['N=input()\nA=input()\nB=input()\na=str(A+B)\nb=str(N/a)\nc=str(N%a)\nif c<A:\n print(str(b*A+c))\nelse:\n print(str(b*A+A))\n', 'N=input()\nA=input()\nB=input()\na=A+B\nb=str(N/a)\nc=str(N%a)\nif c<A:\n print(b*A+c)\nelse:\n print(b*A+A)\n', 'N=input()\nA=input()\nB=input()\na=A+B\nb=N/a\nc=N%a\nif c<A:\n print(b*A+c)\nelse:\n print(b*A+A)', 'N=input()\nA=input()\nB=input()\na=int(A+B)\nb=int(N/a)\nc=int(N%a)\nif c<A:\n print(int(b*A+c))\nelse:\n print(int(b*A+A))\n', 'N=int(input())\nA=int(input())\nB=int(input())\na=int(A+B)\nb=int(N/a)\nc=int(N%a)\nif c<A:\n print(int(b*A+c))\nelse:\n print(int(b*A+A))\n\n ', 'N,A,B=(int(x) for x in input().split())\na=int(A+B)\nb=int(N/a)\nc=int(N%a)\nif c<A:\n print(int(b*A+c))\nelse:\n print(int(b*A+A))\n\n ']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s028658757', 's307354112', 's584852145', 's607021228', 's873868226', 's916342968']
[2940.0, 2940.0, 2940.0, 2940.0, 3064.0, 2940.0]
[19.0, 18.0, 25.0, 17.0, 17.0, 17.0]
[117, 102, 91, 117, 135, 130]
p02754
u830162518
2,000
1,048,576
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?
['N,a,b=map(int,input().split())\nc=N//(a+b)\nd=N%(a+b)\nif d<=a:\n print(c*b+d)\nelse:\n print(c*b+a)\n', 'N,a,b=map(int,input().split())\nc=N//(a+b)\nd=N%(a+b)\nif d<=a:\n print(c*a+d)\nelse:\n print(c*a+a)']
['Wrong Answer', 'Accepted']
['s506854887', 's485350983']
[2940.0, 2940.0]
[17.0, 18.0]
[97, 96]
p02754
u830742419
2,000
1,048,576
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?
['# N\nnum = int(input())\n# A\ngreenNum = int(input())\n# B\nredNum = int(input())\n\n# output\ntotalGreen = 0\nwhile (num > 0):\n if (num <= greenNum):\n totalGreen += num\n num = 0\n else:\n totalGreen += greenNum\n num -= (greenNum + redNum)\n \nprint(totalGreen)', "# N, A, B\nnum, greenNum, redNum = map(lambda x: int(x), input().split(' '))\n\nnumSet = num // (greenNum+redNum)\nremain = num % (greenNum+redNum)\nnumRest = remain if (remain < greenNum) else greenNum\n\ntotalGreen = numSet * greenNum + numRest\n\nprint(totalGreen)\n"]
['Runtime Error', 'Accepted']
['s040656177', 's594758947']
[3060.0, 2940.0]
[17.0, 18.0]
[265, 259]
p02754
u831311378
2,000
1,048,576
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?
['n,a,b = [int(i) for i in input().split()]\nif n%(a+b)>a or n%(a+b)==0:\n print(a)\nelse:\n print(n%(a+b))', 'n,a,b = [int(i) for i in input().split()]\nd=int(n/(a+b))\nr=n%(a+b)\nif r==0:\n print(d*a)\nelif r>a:\n print(d*a+a)\nelse:\n print(d*a+r)']
['Wrong Answer', 'Accepted']
['s415937518', 's422076367']
[2940.0, 3060.0]
[18.0, 18.0]
[103, 134]
p02754
u831752983
2,000
1,048,576
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?
['n,a,b=map(int,input().split())\nans=0\n\nse=n//(a+b)\nn%=a+b\nans+=se*a + min(a,n)\nprnit(ans)', 'n,a,b=map(int,input().split())\nans=0\n\nse=n//(a+b)\nn%=a+b\nans+=se*a + min(a,n)\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s460346484', 's140087370']
[2940.0, 2940.0]
[18.0, 17.0]
[88, 89]
p02754
u833492079
2,000
1,048,576
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?
['n,b,r = map(int, input().split())\t\t# 5 7 2\n\nans = (n//(b+r)) + min(n%(b+r),b)\n\nprint(ans)\n\n', 'n,b,r = map(int, input().split())\t\t# 5 7 2\n\nans = (n//(b+r))*b + min(n%(b+r),b)\n\nprint(ans)\n\n']
['Wrong Answer', 'Accepted']
['s899294061', 's399085993']
[2940.0, 2940.0]
[17.0, 17.0]
[91, 93]
p02754
u833738197
2,000
1,048,576
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?
['n,a,b = map(int, input().split())\n\nans = n//(a + b)*a\nans+=min(a,n%(a+b))\nans', 'n,a,b = map(int, input().split())\n\nans = n//(a + b)*a\nans+=min(a,n%(a+b))\nprint(ans)']
['Wrong Answer', 'Accepted']
['s700234321', 's913338183']
[3064.0, 2940.0]
[20.0, 17.0]
[77, 84]
p02754
u838178977
2,000
1,048,576
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?
['from math import floor\n\nN = int(input())\nA = int(input())\nB = int(input())\n\nsteps = floor(N / (A + B))\ncap = steps * (A + B)\nblue_balls = steps * A + min([N - cap, A])\nprint(blue_balls)', 'from math import floor\n\ninp = input()\nN, A, B = [int(x) for x in inp.split(" ")]\n\nsteps = floor(N / (A + B))\ncap = steps * (A + B)\nblue_balls = steps * A + min([N - cap, A])\nprint(blue_balls)']
['Runtime Error', 'Accepted']
['s300159902', 's236260519']
[3060.0, 3060.0]
[17.0, 18.0]
[185, 191]
p02754
u841021102
2,000
1,048,576
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?
['n, a, b = map(int, input().split())\nif a + b == n:\n print(a)\nelif a == 0:\n print(0)\nelif (n - b) >= a:\n print(a)\nelse:\n print(n - b)', 'n, a, b=map(int,input().split())\ncount = (n // (a + b))*a\nif n % (a + b) >= a:\n count += a\nelse:\n count += n % (a + b)\nprint(count)']
['Wrong Answer', 'Accepted']
['s852896088', 's738391590']
[9112.0, 9172.0]
[32.0, 28.0]
[136, 133]
p02754
u843545660
2,000
1,048,576
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?
['N, A, B = [int(i) for i in input().split()]\n\nS = N//(A+B)*A\n\nS = S+(N%S,A)\nprint(S)', 'N, A, B = [int(i) for i in input().split()]\nS = A+B\nc = (N//S)*A\n \nc += min(N%S,A)\nprint(c)']
['Runtime Error', 'Accepted']
['s838563778', 's470368957']
[2940.0, 3064.0]
[17.0, 25.0]
[83, 91]
p02754
u844813573
2,000
1,048,576
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?
['line = input()\nn, a, b = line.split(" ")\nn = int(n)\na = int(a)\nb = int(b)\n\ni = 0\ni = int(n / (a + b)) + 1\nprint(i)\nif ((a + b)*i) - n <= b:\n print(a * i)\nelse:\n num1 = ((a + b)* i) - n\n num2 = a * i\n num3 = num1 - b\n print(num2 - num3)', 'line = input()\nn, a, b = line.split(" ")\nn = int(n)\na = int(a)\nb = int(b)\n\nnum = 0\ni = 0\ni = int(n / (a + b)) + 1\nif ((a + b)*i) - n <= b:\n print(a * i)\nelse:\n num1 = ((a + b)* i) - n\n num2 = a * i\n num3 = num1 - b\n print(num2 - num3)']
['Wrong Answer', 'Accepted']
['s299673825', 's345195342']
[3064.0, 3064.0]
[17.0, 18.0]
[250, 249]
p02754
u845847173
2,000
1,048,576
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?
['a, b = map(int, input().split())\n\nn = int(input())\n\ns = n // (a + b)\nm = n % (a + b)\n\nif a > m:\n print(a * s + m)\nelse:\n print(a * s + a)', 'import math\n\na, b = map(int, input().split())\n\nn = int(input())\n\ns = math.floor(n // (a + b))\nm = n % (a + b)\n\nif a > m:\n print(a * s + m)\nelse:\n print(a * s + a)', 'import math\n\na, b = map(int, input().split())\n\nn = int(input())\n\ns = math.floor(n / (a + b))\nm = n % (a + b)\n\nif a > m:\n print(a * s + m)\nelse:\n print(a * s + a)', 'a, b = map(int, input().split())\nn = int(input())\nprint(a * (n // (a + b))+ min(n % (a + b), a))', 'a, b = map(int, input().split())\nn = int(input())\nprint(n // (a + b) + min(n % (a + b), a))', 'a, b = map(int, input().split())\n\nn = int(input())\n\ns = n // (a + b)\nm = n % (a + b)\n\nif a > m:\n print(a * s + a)\nelse:\n print(a * s + m)', 'N, A, B = map(int, input().split())\n\nans = 0\nans += N // (A + B) * A\nans += min(N % (A + B), A)\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s036401583', 's315601436', 's500222302', 's570468601', 's615574195', 's905796927', 's687493438']
[2940.0, 3060.0, 3064.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 19.0, 18.0, 17.0]
[143, 168, 167, 96, 91, 143, 106]
p02754
u847692421
2,000
1,048,576
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?
['a=list(input())\n\nIN=[int(x) for x in a if x != " "]\nN=IN[0]\nA=IN[1]\nB=IN[2]\n\nALL=A+B\n\ncnt=0\nnum=N\nwhile True:\n num = num - ALL\n if num > 0:\n cnt += 1\n else:\n break\n\nif ALL - num > A:\n ans = A * cnt + A\nelse:\n ans = A * cnt + ALL - num\n\nprint(ans)', 'N, A, B = [int(x) for x in input().strip().split()]\n\nTimes = N // (A + B)\nrest = N - Times * (A + B)\n\nif rest < A:\n ans = A * Times + rest\nelse:\n ans = A * Times + A\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s401558498', 's374042682']
[3064.0, 2940.0]
[2103.0, 17.0]
[311, 191]
p02754
u848647227
2,000
1,048,576
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?
['n,a,b = map(int,input().split(" "))\ncount = 0\nc = a + b\nif c > n:\n print(min(n,a))\nelse:\n count += a * (n // c)\n d = n % c\n count += min(a,d)\nprint(count)', 'n,a,b = map(int,input().split(" "))\ncount = 0\nc = a + b\ncount += a * (n // c)\nd = n % c\ncount += min(a,d)\nprint(count)']
['Runtime Error', 'Accepted']
['s583666233', 's206851276']
[2940.0, 3060.0]
[17.0, 18.0]
[170, 118]
p02754
u849151695
2,000
1,048,576
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?
['N, A, B = map(int,input().split())\n\nq, x = divmod(N, A+B)\n\n\nans = q*A+int(min(x,A))\n#print(type(ans))\nprint(ans', 'N, A, B = map(int,input().split())\n\nq, x = divmod(N, A+B)\n\n\nans = q*A+int(min(x,A))\n#print(type(ans))\nprint(ans)']
['Runtime Error', 'Accepted']
['s261583222', 's038538265']
[2940.0, 2940.0]
[17.0, 17.0]
[138, 139]
p02754
u852386636
2,000
1,048,576
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?
['N,A,B=map(int,input().split())\n\ncnt_blue = 0\n\npre_loop_cnt = N // (A+B)\ntotol_pre_A = sum([A] * pre_loop_cnt)\ntotol_pre_B = sum([B] * pre_loop_cnt)\n\ntotal_tmp = totol_pre_A + totol_pre_B\ntotal_tmp += A\nif N <= total_tmp:\n cnt_blue = N - totol_pre_B\nelse:\n cnt_blue = totol_pre_A + A', 'N,A,B=map(int,input().split())\n\ncnt_blue = 0\n\n# try:\npre_loop_cnt = N // (A+B)\ntotol_pre_A = sum([A] * pre_loop_cnt)\ntotol_pre_B = sum([B] * pre_loop_cnt)\n\ntotal_tmp = totol_pre_A + totol_pre_B\ntotal_tmp += A\nif N <= total_tmp:\n cnt_blue = N - totol_pre_B\nelse:\n cnt_blue = totol_pre_A + A\n# print(cnt_blue)\n# except:\n# print(0)', 'N,A,B=map(int,input().split())\n\ncnt_blue = 0\n\npre_loop_cnt = N // (A+B)\ntotol_pre_A = sum([A] * pre_loop_cnt)\ntotol_pre_B = sum([B] * pre_loop_cnt)\n\ntotal_tmp = totol_pre_A + totol_pre_B\ntotal_tmp += A\nif N <= total_tmp:\n cnt_blue = N - totol_pre_B\nelse:\n cnt_blue = totol_pre_A + A', 'N,A,B=map(int,input().split())\n\ncnt_blue = 0\ntotal_tmp = 0\n\ntry:\n pre_cnt = N // (A+B)\n total_tmp = pre_cnt * (A+B)\n total_tmp += A\n if N <= total_tmp:\n cnt_blue = N - (pre_cnt * B)\n else:\n cnt_blue = (pre_cnt * A) + A\n print(cnt_blue)\nexcept Exception as e:\n print(0)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s066109136', 's892678636', 's936587179', 's538991984']
[9108.0, 9184.0, 9108.0, 9080.0]
[28.0, 29.0, 29.0, 31.0]
[289, 339, 289, 304]
p02754
u853728588
2,000
1,048,576
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?
['n, a, b = map(int,input().split())\n\nif a != 0:\n answer = n // (a+b)\n remainder = n % (a+b)\n print(answer*a) + min(a, remainder)\nelse:\n print(0)', 'n, a, b = map(int,input().split())\n \nif a != 0:\n answer = n // (a+b)\n remainder = n % (a+b)\n print((answer*a) + min(a, remainder))\nelse:\n print(0)']
['Runtime Error', 'Accepted']
['s566317285', 's470490608']
[9164.0, 9172.0]
[27.0, 29.0]
[147, 150]
p02754
u854612823
2,000
1,048,576
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?
['n,a,b = map(int,input().split())\nx = n // (a+b)\ny = m - (a+b)*x\nif a == 0:\n print(0)\nelif y < a + 1:\n print (x * a + y)\nelse:\n print (x*a + a)', 'n,a,b = map(int,input().split())\nx = n // (a+b)\ny = n - (a+b)*x\nif a == 0:\n print(0)\nelif y < a + 1:\n print (x * a + y)\nelse:\n print (x*a + a)']
['Runtime Error', 'Accepted']
['s353193542', 's744737460']
[3060.0, 3060.0]
[17.0, 17.0]
[145, 145]
p02754
u854685063
2,000
1,048,576
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?
['import sys\nimport math\ndef i():return int(sys.stdin.readline().replace("\\n",""))\ndef i2():return map(int,sys.stdin.readline().replace("\\n","").split())\ndef s():return str(sys.stdin.readline().replace("\\n",""))\ndef l():return list(sys.stdin.readline().replace("\\n",""))\ndef intl():return [int(k) for k in sys.stdin.readline().replace("\\n","").split()]\ndef lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\\n","").split()))\ndef t():return tuple(map(int,sys.stdin.readline().replace("\\n","").split()))\n\nif __name__ == "__main__":pass\nn, a, b = i2()\n\nif a == 0:\n print(0)\nelif b == 0:\n print(n)\nelse:\n cnt = n // (a+b)\n c = n % (a+b)\n print(cnt,c)\n if c <= a:\n print(a*cnt+c)\n else:\n print(a*cnt+c-(c-a))', 'import sys\nimport math\ndef i():return int(sys.stdin.readline().replace("\\n",""))\ndef i2():return map(int,sys.stdin.readline().replace("\\n","").split())\ndef s():return str(sys.stdin.readline().replace("\\n",""))\ndef l():return list(sys.stdin.readline().replace("\\n",""))\ndef intl():return [int(k) for k in sys.stdin.readline().replace("\\n","").split()]\ndef lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\\n","").split()))\ndef t():return tuple(map(int,sys.stdin.readline().replace("\\n","").split()))\n\nif __name__ == "__main__":pass\nn, a, b = i2()\nif a == 0 and b == 0:\n print(0):\nelif a == 0:\n print(0)\nelif b == 0:\n print(n)\nelse:\n cnt = n // (a+b)\n c = n%(a+b)\n if c <= a:\n print(a*cnt+c)\n else:\n print(a*cnt+c-b)', 'import sys\nimport math\ndef i():return int(sys.stdin.readline().replace("\\n",""))\ndef i2():return map(int,sys.stdin.readline().replace("\\n","").split())\ndef s():return str(sys.stdin.readline().replace("\\n",""))\ndef l():return list(sys.stdin.readline().replace("\\n",""))\ndef intl():return [int(k) for k in sys.stdin.readline().replace("\\n","").split()]\ndef lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\\n","").split()))\ndef t():return tuple(map(int,sys.stdin.readline().replace("\\n","").split()))\n\nif __name__ == "__main__":pass\nn, a, b = i2()\n\nif a == 0:\n print(0)\nelif b == 0:\n print(n)\nelse:\n cnt = n // (a+b)\n c = n % (a+b)\n if c <= a:\n print(a*cnt+c)\n else:\n print(a*cnt+c-(c-a))']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s951162108', 's964151799', 's449947069']
[3064.0, 3064.0, 3064.0]
[18.0, 17.0, 19.0]
[756, 770, 739]
p02754
u857330600
2,000
1,048,576
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?
['n,a,b=map(int,input().split())\np=n%(a+b)\nx=(n-p)//(a+b)\nres=x*a\ny=a if p>=a else p\nres+=y\nprint(y)', 'n,a,b=map(int,input().split())\np=n%(a+b)\nx=(n-p)//(a+b)\nres=x*a\ny=a if p>=a else p\nres+=y\nprint(res)']
['Wrong Answer', 'Accepted']
['s508268702', 's402025469']
[2940.0, 3060.0]
[18.0, 17.0]
[98, 100]
p02754
u857346974
2,000
1,048,576
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?
['n,a,b = list(map(int, input().split()))\n\nif (a+b) == 0:\n print(0)\nelse:\n trial_num = n // (a + b)\n amari = n % (a + b)\n \n if a == 0:\n print(0)\n else:\n print(trial_num*a + a)\n', 'n,a,b = list(map(int, input().split()))\n\nif (a+b) == 0:\n print(0)\nelse:\n trial_num = n // (a + b)\n amari = n % (a + b)\n \n if a == 0:\n print(0)\n else:\n if a <= amari:\n print(trial_num*a + a)\n else:\n print(trial_num*a + amari)']
['Wrong Answer', 'Accepted']
['s468543704', 's954718829']
[2940.0, 3060.0]
[18.0, 17.0]
[186, 249]
p02754
u859987056
2,000
1,048,576
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?
['N,A,B = map(int,input().split())\nS = 0\nfor i in range(2*N):\n if i%2 == 0:\n S += A\n if S >= N:\n ans = (i-1)/2*A + N - (i-1)/2*(A+B)\n break\n else:\n S += B\n if S >= N:\n ans = i/2 * A\n break\nprint(ans)', 'N,A,B = map(int,input().split())\nS = 0\nfor i in range(2*N):\n if i%2 == 0:\n S += A\n else:\n S += B:\n if S >= N:\n if i%2 == 0:\n ans = (i-1)/2*A + N - (i-1)/2*(A+B)\n else:\n ans = i/2 * A\n break\nprint(ans)', 'n, a,b = map(int, input().split())\nans = n//(a+b)*a\nrem = n%(a+b)\nans+=min(a,rem)\nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s168011948', 's991824688', 's362862726']
[3060.0, 2940.0, 2940.0]
[2104.0, 17.0, 17.0]
[231, 228, 92]
p02754
u860002137
2,000
1,048,576
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?
['import math\na, b = map(int, input().split())\na = math.ceil(a / 0.08)\nb = math.ceil(b / 0.1)\ntmp_a = set([i for i in range(a, a+13)])\ntmp_b = set([i for i in range(b, b+10)])\nif len(tmp_a & tmp_b) == 0:\n print(-1)\nelse:\n print(min(tmp_a & tmp_b))', 'n, a, b = map(int, input().split())\n\ndiv, mod = divmod(n, a + b)\n\nprint(div * a + min(a, mod))']
['Runtime Error', 'Accepted']
['s471216719', 's126527466']
[3064.0, 8972.0]
[17.0, 28.0]
[251, 94]
p02754
u863397945
2,000
1,048,576
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?
['N, A, B = map(int,input().split())\n\nloop = N//(A+B)\n\nremain = N - loop*(A+B)\n\nif remain <= A:\n remain = remain\nelse:\n remain = A\n\nprint("loop=",loop)\nprint("remain=",remain)\n\nprint(loop*A+remain)', 'N, A, B = map(int,input().split())\n\nloop = N//(A+B)\n\nremain = min(N - loop*(A+B),A)\n\nprint(loop*A+remain)']
['Wrong Answer', 'Accepted']
['s457374212', 's449757261']
[9028.0, 9068.0]
[31.0, 26.0]
[201, 105]
p02754
u865383026
2,000
1,048,576
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?
['N, A, B = map(int, input().split())\nif A == :\n print(0)\nelse:\n print(N) if A > N else print(A if N < (A + B) else N - B)', 'N, A, B = map(int, input().split())\nif A == 0:\n print(0)\nelif A > N or B == 0:\n print(N)\nelse:\n M = N // (A + B)\n print(M)\n if N - M * (A + B) > A:\n print(A * M + A)\n else:\n print(N - M * B)', 'N, A, B = map(int, input().split())\nif A == 0:\n print(0)\nelif A > N or B == 0:\n print(N)\nelse:\n M = N // (A + B)\n if N - M * (A + B) > A:\n print(A * M + A)\n else:\n print(N - M * B)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s923484492', 's984546720', 's758504703']
[2940.0, 3060.0, 3060.0]
[17.0, 17.0, 18.0]
[122, 202, 191]
p02754
u866746776
2,000
1,048,576
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?
['n, a, b = map(int, input().split().rstrip())\nk = n // (a + b)\nr = n % (a + b)\nprint(k * a + min(r, a))\n', 'n, a, b = map(int, input().rstrip().split())\nk = n // (a + b)\nr = n % (a + b)\nprint(k * a + min(r, a))\n']
['Runtime Error', 'Accepted']
['s608778092', 's510759168']
[2940.0, 2940.0]
[18.0, 17.0]
[103, 103]
p02754
u867826040
2,000
1,048,576
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?
['N,A,B = map(int,input().split())\nab = A+B\n\nqaws = ""\nc = 0\nwhile(N >= c):\n qaws = qaws + "B"*A\n qaws = qaws + "R"*B\n c += 1\nprint(qaws)\nprint(qaws[:N].count("B"))', 'N,A,B = map(int,input().split())\nqaws = ""\nwhile(N > len(qaws)):\n qaws += ("B"*A)\n qaws += ("R"*B)\nprint(qaws[:N].count("B")', 'n,a,b=map(int,input().split())\nans = n//(a+b)*a\nr = n%(a+b)\nprint(min(r,a)+ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s011772894', 's187184284', 's788623076']
[1963924.0, 3064.0, 2940.0]
[2252.0, 17.0, 17.0]
[165, 126, 79]
p02754
u868606077
2,000
1,048,576
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?
["import sys\nimport math\n\nstr = input() \nprint(str)\nprint(str.split(' '))\n\nary = str.split(' ')\nN = int(ary[0])\nB = int(ary[1])\nR = int(ary[2])\n\nif(B == 0):\n print(B)\n sys.exit()\n\na = N % (B+R)\nret = math.floor(N / (B+R))*B + (a if a < B else B)\nprint(ret) \n", "import sys\nimport math\n\nstr = input() \n#print(str)\n#print(str.split(' '))\n\nary = str.split(' ')\nN = int(ary[0])\nB = int(ary[1])\nR = int(ary[2])\n\nif(B == 0):\n print(B)\n sys.exit()\n\na = N % (B+R)\nret = math.floor(N / (B+R))*B + (a if a < B else B)\nprint(ret) \n "]
['Wrong Answer', 'Accepted']
['s496190839', 's296615484']
[3316.0, 3060.0]
[23.0, 17.0]
[322, 326]
p02754
u871841829
2,000
1,048,576
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?
['N, A, B = map(int, input().split())\nprint(N//(A+B)+min(N%(A+B), A))', 'N, A, B = map(int, input().split())\nprint((N//(A+B))*A+min(N%(A+B), A))']
['Wrong Answer', 'Accepted']
['s286110993', 's419627819']
[9072.0, 9072.0]
[30.0, 32.0]
[67, 71]
p02754
u871867619
2,000
1,048,576
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?
["n, a, b = map(int, input().split())\n\nb_count = n // (a+b) \nprint('b_count', b_count)\nif (n-(a+b)*b_count) <= a:\n print(n-b*b_count)\nelse:\n print(a*b_count + a)", "n, a, b = map(int, input().split())\n\nb_count = n // (a+b) \nprint('b_count', b_count)\nprint('answer',n-b*b_count)", 'n, a, b = map(int, input().split())\n\nb_count = n // (a+b) \nif (n-(a+b)*b_count) <= a:\n print(n-b*b_count)\nelse:\n print(a*b_count + a)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s200853819', 's399968703', 's300591353']
[2940.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0]
[165, 112, 139]