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
u488272873
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 = A / 0.08\nb = B / 0.1\nif math.floor(a * 0.1) == B:\n ans = int(a)\nelif math.floor(b * 0.08) == A:\n ans = int(b)\nelse:\n print(-1)\n exit()\nif (math.floor((ans-1)*0.08) == A) and (math.floor((ans-1)*0.1) == B):\n ans = ans - 1\nelse:\n print(ans)', 'N,A,B = map(int,input().split())\nif A == 0:\n print(A)\n exit()\nn = N // (A + B)\nnn = N % (A + B)\nif n != 0 and nn <= A:\n print(int(A*n + nn))\nelif n != 0 and nn > A:\n print(int(A*(n+1)))\nelif n == 0 and N >= A:\n print(A)\nelif n == 0 and N < A:\n print(N)']
['Runtime Error', 'Accepted']
['s538025720', 's617233695']
[3064.0, 3064.0]
[17.0, 18.0]
[303, 270]
p02754
u489963060
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\n\n\nfrom math import ceil\n\nimport numpy as np\n\nstrInput = input()\nN, A, B = np.array(strInput.split(' ')).astype(int)\nnumGroup = floor(N / (A + B))\nnumExtendBall = N % (A + B)\nif numExtendBall >= A:\n numExtendBlueBall = A\nelse:\n numExtendBlueBall = numExtendBall\nprint(numGroup * A + numExtendBlueBall)\n", "# coding:utf-8\n\n\nfrom math import floor\n\nimport numpy as np\n\nstrInput = input()\nN, A, B = np.array(strInput.split(' ')).astype(int)\nnumGroup = floor(N / (A + B))\nnumExtendBall = N % (A + B)\nif numExtendBall >= A:\n numExtendBlueBall = A\nelse:\n numExtendBlueBall = numExtendBall\nprint(numGroup * A + numExtendBlueBall)\n"]
['Runtime Error', 'Accepted']
['s396930875', 's196790327']
[12484.0, 20608.0]
[152.0, 286.0]
[322, 323]
p02754
u498620941
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())\nt = N // (A + B)\ns = N % (A + B)\nans = t * A\nif s > A :\n ans += (s - A)\n print(ans)\nelse :\n print(ans)', 'N,A,B = map(int,input().split())\nt = N // (A + B)\ns = N % (A + B)\nans = t * A\nif s > A :\n ans += A\n print(ans)\nelse :\n ans += s\n print(ans)\n']
['Wrong Answer', 'Accepted']
['s899967133', 's219314072']
[3060.0, 2940.0]
[18.0, 17.0]
[144, 152]
p02754
u500942659
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())\nq, mod = divmod(n, a+b)\nprint(b * q + min(mod, a))', 'n, a, b = (int(i) for i in input().split())\nq, mod = divmod(n, a+b)\nprint(a * q + min(mod, a))']
['Wrong Answer', 'Accepted']
['s070591878', 's776738305']
[3060.0, 3060.0]
[18.0, 17.0]
[96, 96]
p02754
u501821796
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()]\nprint(n, a, b)\no = n // (a+b)\nr = n % (a+b)\nprint(o*a + min(r, a))', 'n, a, b = [int(x) for x in input().split()]\nif a == 0:\n print(0)\nelse:\n o = n // (a+b)\n r = n % (a+b)\n print(o*a + min(r, a))']
['Wrong Answer', 'Accepted']
['s329664174', 's525721997']
[2940.0, 3060.0]
[17.0, 17.0]
[110, 137]
p02754
u502594696
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 13\nball=A+B #3+4=7 BBBRRRR BBBRRR\ns=N//ball #1\ny=N%ball #1\nprint(s*A+A)', 'N,A,B=map(int,input().split())\n#N 13 8\nball=A+B #3+4=7 BBBRRRR\ns=N//ball #1\ny=N%ball #6 #1\nif y<A:\n print(s*A+y)\nelse:\n print(s*A+A)']
['Wrong Answer', 'Accepted']
['s569580880', 's657042132']
[9148.0, 9148.0]
[29.0, 29.0]
[105, 134]
p02754
u507351902
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?
["ball = lst[0]\nblue = lst[1]\nred = lst[2]\nblue_red = int(ball / (red + blue)) + 1\n\nblue_str = ''\nfor i in range(blue): blue_str += 'b'\nred_str = ''\nfor i in range(red): red_str += 'r'\n\nmojiretu = ''\nfor i in range(blue_red): mojiretu += (blue_str + red_str)\nprint(mojiretu[:ball].count('b'))", 'lst = [int(i) for i in input().split()]\nball = lst[0]\nblue = lst[1]\nred = lst[2]\n\nred_blue = int(ball / (red + blue))\nshokichi = red_blue * blue\namari = ball - (red_blue * (red + blue))\n\nif amari < blue:\n nokori = amari\nelif amari > blue:\n nokori = blue\nelse:\n nokori = 0\n\nif blue == 0:\n print(0)\nelse:\n print(shokichi + nokori)']
['Runtime Error', 'Accepted']
['s244828088', 's129255863']
[3064.0, 3064.0]
[17.0, 17.0]
[290, 343]
p02754
u507613674
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 collections import defaultdict\nfrom collections import deque\nfrom string import ascii_uppercase\nimport sys, bisect, math, heapq\n\nstdin = sys.stdin\nread_int = lambda : list(map(int,stdin.readline().split()))\nread_str = lambda : stdin.readline().rstrip()\n\nN, A, B = read_int()\n\ndef solve():\n ans = (N / (A + B)) * A\n r = (N % (A + B))\n ans += r if r < A else A\n return ans\n\nif __name__ == "__main__":\n print(solve())', 'from collections import defaultdict\nfrom collections import deque\nfrom string import ascii_uppercase\nimport sys, bisect, math, heapq\n\nstdin = sys.stdin\nread_int = lambda : list(map(int,stdin.readline().split()))\nread_str = lambda : stdin.readline().rstrip()\n\nN, A, B = read_int()\n\ndef solve():\n ans = (N // (A + B)) * A\n r = (N % (A + B))\n ans += r if r < A else A\n return ans\n\nif __name__ == "__main__":\n print(solve())']
['Wrong Answer', 'Accepted']
['s882649584', 's590517405']
[3768.0, 3892.0]
[25.0, 26.0]
[434, 435]
p02754
u508842013
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(input().split())\na = N // ( A + B )\nb = N % ( A + B )\n\nif b >> A:\n print( a * A + A )\nelse:\n print( a * A + b ) ', 'N , A , B = map(int, input().split())\nAB = A + B\na = N // AB\nb = N % AB\n\n\n\nif b > A:\n print( a * A + A )\nelse:\n print( a * A + b ) ']
['Runtime Error', 'Accepted']
['s901861736', 's034741583']
[2940.0, 2940.0]
[17.0, 18.0]
[134, 137]
p02754
u511870776
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())\ni = 0\nAB = A+B\nans = 0\nfor x in range(N):\n if i < A:\n ans += 1\n if i == AB:\n i = 0\n i += 1\n\nprint(ans)', 'N, A, B = map(int, input().split())\nans = 0\namari = N % (A + B)\no = N // (A + B)\nif amari > A:\n amari = A\n\nprint(amari + A * o)\n']
['Wrong Answer', 'Accepted']
['s388119922', 's278705311']
[2940.0, 2940.0]
[2104.0, 17.0]
[161, 131]
p02754
u514118270
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(input().split(' '))\na = N % (A + B)\nb = N // (A + B)\n\nif a > A:\n print(B*b+a)\nelse:\n print(B*b)", 'N,A,B = list(map(int,input().split()))\na = N//(A+B)\nb = N%(A+B)\nif b >= A:\n b = A\nprint(a*A+b)']
['Runtime Error', 'Accepted']
['s356287513', 's346430755']
[2940.0, 2940.0]
[18.0, 17.0]
[109, 97]
p02754
u516579758
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())\na=N//(A+B)\nif N%(A+B)==0:\n print(a*A)\nelif N%(A+B)>=A:\n print(a*A+A))\nelif N%(A+B)<A:\n print(a*A+(N%(A+B)))', 'n,a,b=map(int,input().split())\ni=n%(a+b)\nprint(i)\nif i>a:\n print(a*(n//(a+b))+a)\nelse:\n print(a*(n//(a+b))+i)', 'n,a,b=map(int,input().split())\ni=n%(a+b)\nif i>a:\n print(a*(n//(a+b))+a)\nelse:\n print(a*(n//(a+b))+i)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s046436774', 's542759297', 's207447912']
[9016.0, 2940.0, 9172.0]
[30.0, 17.0, 30.0]
[147, 115, 106]
p02754
u516678561
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(' ')))\nab = ''\n\nwhile len(ab) < n and len(ab) != 0:\n ab = ab + ('a' * a) + ('b' * b)\n\nprint(ab[:n].count('a'))\n", "n, a, b = list(map(int, input().split(' ')))\n\nblue_ball = 0\nif n / (a + b) > 1:\n answer = divmod(n, a + b)\n blue_ball = answer[0] * a\n n = answer[1]\n\nif n > a:\n blue_ball += a\nelse:\n blue_ball += n\n\nprint(blue_ball)"]
['Wrong Answer', 'Accepted']
['s581306675', 's520371717']
[2940.0, 3060.0]
[17.0, 17.0]
[152, 230]
p02754
u516974577
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?
['print(0)', 'N, a, b = map(int, input().split())\nprint(N)', 'import math\nN, a, b = map(int, input().split())\n\nall = a + b\n\n# a = 0\nif a == 0:\n print(0)\n exit(0)\n\nif N <= a:\n print(N)\n exit(0)\n\n# a > 0\nc = math.floor(N / all)\nd = N % all\n\nroundCnt = a * c\namariCnt = 0\n\nif d != 0:\n if d <= a :\n amariCnt = d\n else:\n amariCnt = a\n\nprint(roundCnt + amariCnt)\n\n\n#a = 0 print 0\n#a > 0\n# N <= a print N\n# N > a\n\n\n\n\n#\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s106184415', 's123526896', 's080525148']
[2940.0, 2940.0, 3060.0]
[18.0, 19.0, 18.0]
[8, 44, 528]
p02754
u517447467
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 = list(map(int, input().split()))\nprint((N[0]//(N[1]+N[2])*N[1] + min([N[0]%(N[1]+N[2]), N[1]]))', 'N = list(map(int, input().split()))\nprint((N[0]//(N[1]+N[2]))*N[1] + min([N[0]%(N[1]+N[2]), N[1]]))\n']
['Runtime Error', 'Accepted']
['s653884741', 's052511010']
[2940.0, 2940.0]
[17.0, 18.0]
[98, 100]
p02754
u534450736
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) * n\ntmp = n % (a+b)\nans += min(a, tmp)\n\nprint(ans)', 'n, a, b = map(int, input().split())\n\nans = n // (a+b) * a\ntmp = n % (a+b)\nans += min(a, tmp)\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s571200312', 's089330453']
[2940.0, 2940.0]
[17.0, 18.0]
[104, 105]
p02754
u536642030
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,blue,red = input().split()\ncount = 0\nwhile(1):\n if N > 0:\n N -= blue\n count += 1\n if N > 0:\n N -= red\n else:\n break\nprint(blue*count + N)', 'N,blue,red = map(int,input().split())\ncount = N // (blue + red)\namari = N % (blue + red)\nif N%(blue+red) >= blue:\n print(blue*(count + 1))\nelse:\n print(blue * count + amari)']
['Runtime Error', 'Accepted']
['s195703314', 's679516240']
[2940.0, 2940.0]
[18.0, 17.0]
[154, 179]
p02754
u537550206
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)\nx = n % (a + b)\nans += min(a, x)\nprint(ans)', 'n, a, b = map(int, input().split())\nans = n // (a + b) * a\nx = n % (a + b)\nans += min(a, x)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s865790813', 's642034755']
[2940.0, 2940.0]
[25.0, 17.0]
[98, 102]
p02754
u537722973
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\nn,a,b = map(int,input().split())\nr = math.ceil(n/(a+b))\nretukaioh = ""\nfor i in range(r):\n retukaioh = retukaioh + "b"*a + "r"*b\nprint(retukaioh[0:n].count("b"))\nprint(retukaioh)', 'n,a,b = map(int,input().split())\nrest = n%(a+b)\nans = n//(a+b)*a\nprint(ans+a if rest >=a else ans+rest)']
['Runtime Error', 'Accepted']
['s765018407', 's422618280']
[22944.0, 9100.0]
[2206.0, 32.0]
[191, 103]
p02754
u539517139
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 if n<=a else a)', 'n,a,b=map(int,input().split())\nif n<=a:\n print(n)\nelse:\n d=n//(a+b)\n z=n-(a+b)*d\n print(a*d+min(a,z))']
['Wrong Answer', 'Accepted']
['s083019120', 's481838769']
[2940.0, 3060.0]
[18.0, 17.0]
[54, 105]
p02754
u541806319
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?
["S = Input()\nN,A,B = S.split(' ')\nN = int(N)\nA = int(A)\nB = int(B)\nans = N //(A+B) * A\nleft = N % (A+B)\nif left > A:\n ans += A\nelse:\n ans += left\nprint(ans)", "S = input()\nN,A,B = S.split(' ')\nN = int(N)\nA = int(A)\nB = int(B)\nprint(int(N/(A+B))*A)", "S = input()\nN,A,B = S.split(' ')\nN = int(N)\nA = int(A)\nB = int(B)\nans = N //(A+B) * A\nleft = N % (A+B)\nif left > A:\n ans += A\nelse:\n ans += left\nprint(ans)"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s354800980', 's460181443', 's804432524']
[3060.0, 2940.0, 3060.0]
[17.0, 18.0, 17.0]
[161, 87, 161]
p02754
u543719609
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()\nz=A+B\nif n%z<=A:\n print(int(n/z)*A+n%z)\nelif A<=n%z<=z:\n print(int(n/z)*A)', 'n,A,B=map(int,input().split())\nz=A+B\nif n%z<=A:\n print(int(n/z)*A+n%z)\nelif A<=n%z<=z:\n print(int(n/z)*A+A)']
['Runtime Error', 'Accepted']
['s349352353', 's488298935']
[9008.0, 9076.0]
[26.0, 28.0]
[110, 113]
p02754
u544165032
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 = list(map(int, input().split()))\ns = b * n[1]\nt = r * n[2]\nu = 10**100\nv = (s + t) * u\nw = v.count("b", 0, n[0])\nprint(w)', 'N, A, B = map(int, input().split())\nC = A + B\nD = N // C\nE = N % C\nif N <= A:\n print(N)\nelif N <= C:\n print(A)\nelse:\n if E <= A:\n print(A*D + E)\n else:\n print(A*D + A)']
['Runtime Error', 'Accepted']
['s814605836', 's764786906']
[2940.0, 3060.0]
[18.0, 17.0]
[124, 193]
p02754
u546386229
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 = A + B\nx = N // C\ny = N % C\np = x * A\nq = min(y, A)\np + q', 'N, A, B = map(int, input().split())\nC = A + B\nx = N // C\ny = N % C\np = x * A\nq = min(y, A)\nprint(p + q)']
['Wrong Answer', 'Accepted']
['s279259275', 's106587782']
[2940.0, 3060.0]
[17.0, 17.0]
[96, 103]
p02754
u549383771
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?
['total,blue,red=map(int,input().split())\nnum = -(-total)//(blue+red)\nif blue == 0:\n print(0)\nelse:\n if (total%(red+blue)) >= blue:\n print(num*blue+(total%(red+blue)))\n else:\n print(num*blue+blue)', 'total,blue,red=map(int,input().split())\nnum = -(-total)//(blue+red)\nif blue == 0:\n print(0)\nelse:\n if (total%(red+blue)) <= blue:\n print(num*blue+(total%(red+blue)))\n else:\n print(num*blue+blue)']
['Wrong Answer', 'Accepted']
['s248971819', 's920622872']
[3060.0, 3060.0]
[19.0, 18.0]
[217, 217]
p02754
u549494450
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 = input().split(" ")\nn = int(a[0])\nb = int(a[1])\nr = int(a[2])\nc = a // (b + r)\nbb = c * b\nd = a % (b + r)\nif d >= b:\n\tbb += b\nelse:\n\tbb += d \nprint(bb)', 'a = input().split(" ")\nn = int(a[0])\nb = int(a[1])\nr = int(a[2])\nc = n // (b + r)\nbb = c * b\nd = n % (b + r)\nif d >= b:\n\tbb += b\nelse:\n\tbb += d \nprint(bb)']
['Runtime Error', 'Accepted']
['s688820079', 's197804215']
[3060.0, 3060.0]
[17.0, 18.0]
[154, 154]
p02754
u550814027
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?
['\ni = list(map(int, input().split()))\nkazoeru = i[0]\nao = i[1]\naka= i[2]\nkaisuu = i[0]/(i[1]+i[2])\n\nanswer = divmod(kazoeru, (i[1]+i[2]))\n\nif ao == 0:\n print(0)\n exit()\n\n\naa = ao * answer[0]\n\n\n\nif answer[1] >= kazoeru:\n aa += answer[1]\n\nelse:\n aa += ao\n\nprint(aa)', '\ni = list(map(int, input().split()))\nkazoeru = i[0]\nao = i[1]\naka= i[2]\nkaisuu = i[0]/(i[1]+i[2])\n\nanswer = divmod(kazoeru, (i[1]+i[2]))\n\nif ao == 0:\n print(0)\n exit()\n\n\naa = ao * answer[0]\n\n\nif answer[1] == 0:\n print(aa)\n exit()\n\nif answer[1] > kazoeru:\n aa += answer[1]\n\nelse:\n aa += ao\nprint(aa)', '\ni = list(map(int, input().split()))\nkazoeru = i[0]\nao = i[1]\naka= i[2]\nkaisuu = i[0]/(i[1]+i[2])\n\nanswer = divmod(kazoeru, (i[1]+i[2]))\n\nif ao == 0:\n print(0)\n exit()\n\n\naa = ao * answer[0]\n\n\nif answer[1] == 0:\n print(aa)\n exit()\n\n\nif answer[1] >= kazoeru:\n aa += kazoeru\n\nelse:\n aa += ao\nprint(aa)', '\ni = list(map(int, input().split()))\nkazoeru = i[0]\nao = i[1]\naka= i[2]\nkaisuu = i[0]/(i[1]+i[2])\n\nanswer = divmod(kazoeru, (i[1]+i[2]))\n\nif ao == 0:\n print(0)\n exit()\n\n\naa = ao * answer[0]\n\n\nif answer[1] == 0:\n print(aa)\n exit()\n\n\n\nif answer[1] >= ao:\n aa += ao\n\nelse:\n aa += answer[1]\nprint(aa)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s192228840', 's431667258', 's905073091', 's548526851']
[3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 21.0, 17.0, 17.0]
[395, 437, 437, 515]
p02754
u552143188
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) >= 10**100:\n print(A*N//(A+B) + min(N%(A+B),A))\nelse :\n print(A * 10**100)', 'N,A,B = map(int,input().split())\nprint( N//(A+B)*A + min(N%(A+B), A))']
['Wrong Answer', 'Accepted']
['s179840651', 's634409381']
[2940.0, 2940.0]
[17.0, 18.0]
[125, 69]
p02754
u553308611
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(int(A * (N / (A + B))))', 'N, A, B = map(int, input().split())\ni = int((N / (A + B)))\nn = A * i\nif N - (A + B) * i > A:\n n += A\nelse:\n n += N - (A + B) * i\nprint(n)']
['Wrong Answer', 'Accepted']
['s072297797', 's326238955']
[2940.0, 2940.0]
[17.0, 18.0]
[65, 143]
p02754
u553600587
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(v) for v in input().strip().split(" ")]\n\nitems = []\nwhile len(items) < N:\n items.append(\'b\' * A)\n items.append(\'r\' * B)\n\nprint(items.count("b"))', 'N, A, B = [int(v) for v in input().strip().split(" ")]\n\nloop, m = divmod(N, A + B)\nprint(loop * A + (m if m < A else A))']
['Runtime Error', 'Accepted']
['s309404212', 's481406317']
[2085748.0, 2940.0]
[2326.0, 18.0]
[167, 120]
p02754
u553824105
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())\nrepete = N//(A+B)\nsub = N%(A+B)\nprint(repete+sub)', 'N,A,B = map(int,input().split())\nrepete = N//(A+B)\nsub = N%(A+B)\nif sub <= A:\n\tprint(A*repete+sub)\nelse:\n\tprint(A*repete+A)']
['Wrong Answer', 'Accepted']
['s947227853', 's695331426']
[2940.0, 2940.0]
[17.0, 17.0]
[82, 123]
p02754
u555291433
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?
['#!/usr/bin/env python\n\nn, a, b = [int(val) for val in input().split()]\n\nprint(n, a, b)\n\nro = a + b\ns = int(n / ro)\nr = n % ro\nra = min(r, a)\nprint(s * a + ra)\n', '#!/usr/bin/env python\n\nn, a, b = [int(val) for val in input().split()]\n\nro = a + b\ns = int(n / ro)\nr = n % ro\nra = min(r, a)\nprint(s * a + ra)\n']
['Wrong Answer', 'Accepted']
['s208274754', 's884394098']
[3064.0, 2940.0]
[17.0, 17.0]
[159, 143]
p02754
u556069480
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?
['nums=input().split(" ")\nN,B,R=[int(nums[i]) for i in range(len(nums))]\nif N>=B:\n print(B)\nelse:\n print(N)\n', 'nums=input().split(" ")\nN,B,R= [int(nums[i]) for i in range(len(nums))]\nsum=B+R\n\nsets,amari=N//sum,N%sum\nif amari>=B:\n\tx=B\nelse:\n\tx=amari\n\nprint(sets*B+x)']
['Wrong Answer', 'Accepted']
['s467078029', 's062851765']
[2940.0, 3060.0]
[17.0, 18.0]
[108, 154]
p02754
u556161636
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?
['inp=list(map(int,input().split()))\nS=inp[0]\nB=inp[1]\nR=inp[2]\nans=B+(S-B-A)\nprint(ans)', 'inp=list(map(int,input().split()))\nS=inp[0]\nB=inp[1]\nR=inp[2]\nx=S//(B+R)\ny=S//(B+R)\nprint(b*x+y)', 'inp=list(map(int,input().split()))\ns=inp[0]\nb=inp[1]\nr=inp[2]\nprint(s//(b+r)*b+min(s%(b+r),b))\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s362026820', 's939567063', 's885787649']
[2940.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0]
[86, 120, 95]
p02754
u557565572
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\nshou = n // (a+b)\namari = n % (a+b)\n\nans = shou * a + a if amari >= a\u3000else ans = shou*a+amari\n\nprint(ans)', 'n,a,b = map(int, input().split())\n\nshou = n // (a+b)\namari = n % (a+b)\n\nprint(shou * a + a) if amari >= a\n\nprint(shou * a + amari) if amari < a', 'n,a,b = map(int, input().split())\n\nshou = n // (a+b)\namari = n % (a+b)\n\nans = shou*a+a if amari >= a\u3000else shou*a+amari\n\nprint(ans)', 'n,a,b = map(int, input().split())\n\nshou = n // (a+b)\namari = n % (a+b)\n\nprint(shou * a + a) if amari >= a\u3000else print(shou*a+amari)', 'n,a,b = map(int, input().split())\n\nshou = n // (a+b)\namari = n % (a+b)\n\nans = shou * a + a if amari >= a\u3000else shou*a+amari\n\nprint(ans)', 'n,a,b = map(int, input().split())\n\nshou = n // (a+b)\namari = n % (a+b)\n\nans = shou*a+a if amari >= a else shou*a+amari\n\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s161010143', 's210024232', 's469861086', 's509103655', 's984502852', 's021718374']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 17.0]
[142, 143, 132, 132, 136, 130]
p02754
u558129042
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?
['number = input().split(" ")\nN = int(number[0])\nB = int(number[1])\nR = int(number[2])\n\na = int(B+R)\nb = int(N/a)\nc = int(N%a)\n\nprint(R)\nif b <= 0:\n print(B)\nelif R == 0:\n print(N)\nelif B == 0:\n print(0)\nelse:\n print((b*B)+c)', 'number = input().split(" ")\nN = int(number[0])\nB = int(number[1])\nR = int(number[2])\n\na = int(B+R)\nb = int(N/a)\nc = int(N%a)\n\nif b <= 0:\n if R ==0:\n print(N)\n else:\n if B > N:\n print(N)\n else:\n print(B)\nelse:\n if R == 0:\n print(N)\n else:\n if B == 0:\n print(0)\n else:\n if c > B:\n print((b*B)+B)\n else:\n print((b*B)+c)']
['Wrong Answer', 'Accepted']
['s018486417', 's907652383']
[3188.0, 3064.0]
[20.0, 18.0]
[235, 455]
p02754
u560222605
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 n>=a and n>0:\n c+=a\n n=n-a-b\n if n<a:\n break\n else:\n continue\nprint(c)', 'n,a,b=map(int,input().split())\nc=a+b\nd=n//c\ne=n%c\nif d>=0 and e>=a:\n print(d*a+a)\nelif d>=0 and e<a:\n print(d*a+e)\nelse:\n print(a)']
['Wrong Answer', 'Accepted']
['s514881778', 's287629219']
[2940.0, 3060.0]
[2104.0, 17.0]
[137, 139]
p02754
u564770050
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))*a + max(0,n%(a+b)-b))', 'n,a,b = map(int,input().split())\nprint((n//(a+b))*a + min(a,n%(a+b)))']
['Wrong Answer', 'Accepted']
['s147868305', 's889182317']
[2940.0, 2940.0]
[17.0, 17.0]
[71, 69]
p02754
u566574814
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+n)*a\nrem=n%(a+b)\nans+=min(rem,a)\nprint(ans)', 'n,a,b=map(int,input().split())\n\nans=n//(a+b)*a\nrem=n%(a+b)\nans+=min(rem,a)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s470505117', 's622526118']
[2940.0, 2940.0]
[17.0, 17.0]
[85, 85]
p02754
u569479281
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\na = int(N - B)\n\npritn(a)', 'N, A, B = map(int, input().split())\nans = N //(A + B)*A\nrem = N % (A +B)\nans += min(rem, A)\n\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s685901726', 's225142837']
[2940.0, 2940.0]
[17.0, 18.0]
[61, 104]
p02754
u569776981
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\nballs_list = []\nwhile len(balls_list) <= n:\n balls_list.append(['r'] * a)\n balls_list.append(['b'] * b)\n\nnew_list = balls_list[ :n]\n\nfrom collections import Counter\n\ncount = Counter(new_list)\n\nx = count['b']\n\nprint(x)", 'N, A, B = map(int,input().split())\nx = N // (A + B)\ny = N % (A + B)\nans = x * A + min(y,A)\nprint(ans)']
['Runtime Error', 'Accepted']
['s655484500', 's916344353']
[8948.0, 9108.0]
[30.0, 29.0]
[258, 101]
p02754
u570944601
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());B+=A;print(N/B*A+min(N%B,A))', 'N,A,B=map(int,input().split());print(N/B*A+min(N%B,A))', 'N,A,B=map(int,input().split());B+=A;print(N//B*A+min(N%B,A))']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s153297598', 's274915485', 's173577594']
[2940.0, 3064.0, 2940.0]
[18.0, 17.0, 17.0]
[59, 54, 60]
p02754
u574590381
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?
['\nn, a, b = list(map(int, input().split()))\n\nsum = a+b\n\nif n < a+b:\n\n if n < a :\n print(n)\n else:\n print(a)\n\nelse:\n res = ((n // sum)*a) + (n % sum)\n \n if n%sum > a: \n print( ((n // sum)*a) + a\n\n else:\n print(res)\n', '\nn, a, b = list(map(int, input().split()))\n\nsum = a+b\n\nif n < a+b:\n\n if n < a :\n print(n)\n else:\n print(a)\n\nelse: \n if n%sum > a: \n print (((n // sum)*a) + a)\n\n else:\n res = ((n // sum)*a) + (n % sum)\n print(res)\n']
['Runtime Error', 'Accepted']
['s477434101', 's010115872']
[2940.0, 3060.0]
[17.0, 18.0]
[259, 260]
p02754
u575101291
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())\nl = []\nfor i in range(n):\n for j in range(a):\n l.append("b")\n for k in range(b):\n l.append("r")\nprint(l.count("b"))', 'import math\nans = 0\nn,a,b = map(int,input().split())\nsetu = math.floor(n/(a+b))\nmod = n % (a+b)\nif mod >= a:\n ans += a\nelse:\n ans += mod\nans += setu * a\nprint(ans)\n# ans = setu*a+mod']
['Wrong Answer', 'Accepted']
['s494303340', 's042703523']
[195224.0, 3060.0]
[2113.0, 18.0]
[168, 188]
p02754
u577170763
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 unittest\nfrom solution import Solution\n\n\nclass TestSolution(unittest.TestCase):\n\n def test_001(self):\n \n solution = Solution()\n\n # actual\n N, A, B = 6, 2, 4\n\n actual = solution.solve(N, A, B)\n\n # expect\n expect = 2\n\n \n self.assertEqual(actual, expect)\n\n def test_002(self):\n \n solution = Solution()\n\n # actual\n N, A, B = 10**18, 5, 5\n\n actual = solution.solve(N, A, B)\n\n # expect\n expect = 5 * 10**17\n\n \n self.assertEqual(actual, expect)\n\n\nif __name__ == '__main__':\n unittest.main()\n", "class Solution:\n def solve(self, N: int, A: int, B: int) -> int:\n\n return (N // (A+B)) * A + min(N % (A+B), A)\n\n\nif __name__ == '__main__':\n\n # standard input\n N, A, B = map(int, input().split())\n\n # solve\n solution = Solution()\n print(solution.solve(N, A, B))\n"]
['Runtime Error', 'Accepted']
['s596893946', 's436194965']
[6348.0, 2940.0]
[71.0, 18.0]
[678, 286]
p02754
u578441226
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())\nS = n % (A+B) - A\nAcount = n % (A+B)\nAnsn = n / (A+ B) * A\nif S <= 0\n print(Ansn + Acount)\nelse\n print(Ansn + A)', 'N,A,B = (int(x) for x in input().split())\nS = N % (A+B) - A\nAcount = N % (A+B)\nAnsn = int(N / (A + B)) * A\nif S <= 0:\n print(Ansn + Acount)\nelse:\n print(Ansn + A)\n']
['Runtime Error', 'Accepted']
['s171499795', 's906265799']
[2940.0, 2940.0]
[18.0, 17.0]
[161, 170]
p02754
u578647703
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)\nresult = A * count\n\nnokori = N - result\nif N % (A+B):\n if nokori - A <= 0:\n result += nokori\n else:\n result += A\n\nprint(result)', 'N, A, B = map(int, input().split())\ncount = N // (A+B)\nresult = N - (B*count)\n\nif N % (A+B) != 0:\n nokori = N - result\n if nokori - A >= 0:\n result += nokori\n else:\n result += A\n\nprint(result)', 'N, A, B = map(int, input().split())\nresult = 0\n\nwhile N!=0:\n if N-A<0:\n result += A - N\n N = 0\n else:\n result += A\n N -= A\n if N-B<0:\n N = 0\n else:\n N -= B\nprint(result)', 'N, A, B = map(int, input().split())\ncount = N // (A+B)\n\nresult = A * count\nif N % (A+B) != 0:\n result += N - result\n\nprint(result)', 'N, A, B = map(int, input().split())\n\ncount = N // (A+B)\nresult = A * count\n\nnokori = N - (result+(B*count))\nif N % (A+B):\n if nokori <= A:\n result += nokori\n else:\n result += A\n\nprint(result)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s058898100', 's078065653', 's353015812', 's506707930', 's932122929']
[3060.0, 2940.0, 3060.0, 2940.0, 2940.0]
[18.0, 17.0, 2104.0, 17.0, 20.0]
[202, 215, 223, 133, 211]
p02754
u580920947
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?
["#!/usr/bin/env python\n\ndef input():\n return sys.stdin.readline()[:-1]\n\ndef main():\n n, a, b = map(int, input().split())\n print(n // (a+b) * a + min(n % (a+b), a))\n\nif __name__ == '__main__':\n main()", "#!/usr/bin/env python\n\ndef main():\n n, a, b = map(int, input().split())\n print(n // (a+b) * a + min(n % (a+b), a))\n\nif __name__ == '__main__':\n main()\n\n"]
['Runtime Error', 'Accepted']
['s640424190', 's009625922']
[2940.0, 2940.0]
[18.0, 18.0]
[210, 161]
p02754
u581403769
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) * a\nk = n % (a + b)\nif k <= a:\n print(n + k)\nelse:\n print(n + a)', 'n, a, b = map(int, input().split())\n\nx = n // (a + b) * a\nk = n % (a + b)\nif k <= a:\n print(x + k)\nelse:\n print(x + a)\n']
['Wrong Answer', 'Accepted']
['s431713511', 's671066451']
[2940.0, 2940.0]
[18.0, 17.0]
[124, 125]
p02754
u581603131
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())\nset_bule = N//(A+B) * A\nother = N - N//(A+B) * (A+B)\nif 0 <= other <= A:\n hashi_ bule = other\nelse :\n hashi_bule = A\nprint(set_bule + hashi_bule)', 'N, A, B = map(int, input().split())\nset_bule = //(A+B) * A\nother = N - N//(A+B) * (A+B)\nif 0 <= other <= A:\n hashi_ bule = other\nelse :\n hashi_bule = A\nprint(set_bule + hashi_bule) ', 'N, A, B = map(int, input().split())\nset_bule = N//(A+B) * A\nother = N - N//(A+B) * (A+B)\nhashi_bule=0\nif 0 <= other <= A:\n hashi_bule = other\nelse :\n hashi_bule = A\nprint(set_bule + hashi_bule) ']
['Runtime Error', 'Runtime Error', 'Accepted']
['s143893313', 's763201938', 's006764537']
[2940.0, 2940.0, 3060.0]
[18.0, 17.0, 17.0]
[187, 187, 200]
p02754
u582415761
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?
['ans = (N // (A+B)) * A\nN -= ((A+B) * (N // (A+B)))\nif N >= A:\n ans+=A\nelse:\n ans+=N\n\nprint(ans)', 'N,A,B = map(int,input().split())\n\nif B==0:\n print(N)\nelif A==0:\n print(0)\nelse:\n n = (N//(A+B))\n ans = n * A\n N -= n*(A+B)\n if N >= A:\n ans+=A\n else:\n ans+=N\n print(ans)']
['Runtime Error', 'Accepted']
['s994885567', 's437006553']
[2940.0, 3060.0]
[17.0, 18.0]
[101, 207]
p02754
u593364182
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())\nalist=[]\ncount=0\n\nwhile len(alist)>n:\n for i in range(b):\n alist.append('b')\n for i in range(r):\n alist.append('r')\n\ndel alist[n:]\n\nfor i in alist:\n if i=='b':\n count+=1\n\nprint(count)", 'n,b,r=map(int,input().split())\n\nans=n//(b+r)*b\nsur=n%(b+r)\nans+=min(sur,b)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s476374027', 's366428357']
[3064.0, 2940.0]
[18.0, 17.0]
[226, 85]
p02754
u596297663
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,n = input().split()\nset = n//(a+b)\nrem = n % (a+b)\nif rem <= a:\n\treturn set * (a+b) + a\nelse:\n\treturn set * (a+b) + rem\n', 'n,a,b = map(int, input().split())\nif a==0 and b==0:\n \tprint(0)\nelse:\n\tset = n//(a+b)\n\trem = n % (a+b)\n\tif rem >= a:\n\t\tprint( set * a + a)\n\telse:\n\t\tprint( set * a + rem)']
['Runtime Error', 'Accepted']
['s377865114', 's486220409']
[2940.0, 3060.0]
[18.0, 17.0]
[124, 169]
p02754
u597017430
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 == 0:\n print(0)\nelse:\n print( (n //(a+b))*a + max(a, n%(a+b)) )', 'n, a, b = map(int, input().split())\nif a == 0:\n print(0)\nelse:\n print( (n //(a+b))*a + min(a, n%(a+b)) )']
['Wrong Answer', 'Accepted']
['s587807448', 's390402009']
[2940.0, 2940.0]
[17.0, 18.0]
[106, 106]
p02754
u597455618
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())\ncnt = 0\nans = 0\nif n//(a+b) <= 10**100:\n ans += a * n//(a+b)\n cnt += (n//(a+b))*(a+b)\nelse:\n ans += a * (10**100//(a+b))\n cnt += (10**100//(a+b))*(a+b)\n\nif n - cnt >= a:\n ans += a:\nelse:\n ans += n - cnt\nprint(ans)', 'n, a, b = map(int, input().split())\ncnt = 0\nans = 0\nl = (a+b)\nif n//l <= 10**100:\n ans += a * (n//l)\n cnt += (n//l)*l\n if n - cnt >= a:\n ans += a\n else:\n ans += max(n - cnt, 0)\nelse:\n ans += a * 10**100\n cnt += 10**100\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s083487925', 's383979892']
[2940.0, 3060.0]
[17.0, 18.0]
[267, 262]
p02754
u600261652
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(min((N//(A+B))*A + N-(N//(A+B)), (N//(A+B))*A + A))', 'N, A, B = map(int, input().split())\nprint(min((N//(A+B))A + N-(N//(A+B), (N//(A+B))A + A))', 'N, A, B = map(int, input().split())\nprint(min((N//(A+B))*A + N - (N//(A+B))*(A+B), (N//(A+B))*A + A))']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s016344050', 's824109550', 's706874030']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[93, 90, 101]
p02754
u603939330
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?
["\nN, A,B = map(int, input().split())\nstr = []\nfor j in range(N//(A+B)+1):\n for i in range(A):\n if i==N+1:\n break\n str.append('b')\n\n for i in range(B):\n if i==N+1:\n break\n str.append('r')\nprint(str)\ncount = 0\nfor k in range(N):\n if str[k] == 'b':\n count+=1\nprint(count)\n", "\nN, A,B = map(int, input().split())\n\nif A==0 and B==0:\n print('0')\n\nelse:\n\n list_ab = []\n list_b = ['b']*A\n list_ab+=(list_b)\n list_a = ['a']*B\n list_ab+=list_a\n\n count = (N//(A+B))+1\n str = list_ab*count\n\n str = str[:N]\n print(str)\n print(str.count('b'))\n", 'N,A,B = map(int, input().split())\n\ncount = N//(A+B)\nif (N-count*(A+B))>A:\n print(count*A+A)\nelse:\n print(count*A+(N-count*(A+B)))\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s511801138', 's793932889', 's798338453']
[113944.0, 3064.0, 3064.0]
[2108.0, 17.0, 18.0]
[334, 289, 136]
p02754
u604269317
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?
['x, b, r = map(int, input().split())\ncount=0\nflag_b=0\nflag_r=0\nwhile:\n count+=b if count!=x else break\n flag_b+=1\n count+=r if count!=x else break\n flag_r+=1\n \n \nprint(x-(flag_r*r))', 'x, b, r = map(int, input().split())\nk=x/(b+r)\nprint(k*b+min(x%(b+r), b))', 'x, b, r = map(int, input().split())\nk=int(x/(b+r))\nprint(k*b+min(x%(b+r), b))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s119480912', 's167394321', 's217438216']
[3064.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0]
[186, 72, 77]
p02754
u607558942
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\narray = []\n\nt = 0\n\nwhile t < 10 ** 100:\n for p in range(a):\n array.append('blue')\n for q in range(b):\n array.append('red')\n t += 1\n \nx = 0\n\nfor i in range(n):\n if array[i] == 'blue':\n x += 1\n\nprint(x)", 'n, a, b = map(int, input().split())\n\nf = n // (a+b)\ng = n % (a+b)\n\nif g <= a:\n print(a * f + g)\n \nelse:\n print(a * (f+1))']
['Time Limit Exceeded', 'Accepted']
['s531610160', 's002352795']
[204184.0, 2940.0]
[2117.0, 17.0]
[273, 130]
p02754
u610042046
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())\na_b = n//(a+b)*a\nprint(a_b)\nif n - n//(a+b)*(a*b) < a:\n print(a_b + (n - n//(a+b)*(a+b)))\nelse:\n print(a_b + a)', 'n, a, b = map(int,input().split())\na_b = n//(a+b)*a\nif n%(a+b) < a:\n print(a_b + n%(a+b))\nelse:\n print(a_b + a)']
['Wrong Answer', 'Accepted']
['s663726210', 's766838550']
[9156.0, 9064.0]
[28.0, 30.0]
[152, 117]
p02754
u617037231
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))*A)', 'N,B,R = map(int,input().split())\nif B == 0:\n print(0)\nif B == 0 and R != 0:\n print(N)\nlimit = N//(B+R) \nblue = limit * B\nprint(blue)\nred = limit * R\nN-=(blue+red)\ncount = 0\nwhile N > 0 and count < blue:\n N-=1\n blue += 1\n count += 1\n if count == B:\n N-=R\n if N>0:\n count = 0\n continue\nprint(blue)', 'import sys\nimport math\nN,B,R = map(int,input().split())\nblue = 0\nif B == 0:\n print(0)\nif B != 0 and R == 0:\n print(N)\nlimit = N//(B+R) \nblue = limit*B\nprint(blue) #15 of 100,10,7\ndifference = N - (limit * (B+R))\nif B <= difference:\n blue += B\n print(blue)\nelse:\n blue += difference\n print(blue)', 'N,A,B = map(int,input().split())\nR = N%(A+B)\nres = (N//(A+B))*A\nif R == 0:\n print(res)\nelse:\n if R<A:\n print(res+R)\n else:\n print(res+A)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s010710495', 's100872588', 's496146405', 's490377896']
[2940.0, 3064.0, 3064.0, 3060.0]
[17.0, 2107.0, 17.0, 17.0]
[52, 324, 307, 145]
p02754
u617103038
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 ans = n //(a+b) *a\n ans += min(n%(a+b),a)\n print(ans)', ' n,a, b = map(int, input().split())\n l = []\n for i in range(10 ^100):\n l.extend([1]*a)\n l.extend([0]*b)\n \n print(sum(l[:n]))', ' n,a, b = map(int, input().split())\n l = []\n for i in range(10 ^100):\n l.extend([1]*a)\n l.extend([0]*b)\n \n print(sum(l[:n]))', ' n,a, b = map(int, input().split())\n ans = n //(a+b) *a\n tmp = n%(a+b)\n ans += min(tmp,a)\n print(ans)', 'n,a, b = map(int, input().split())\nans = n //(a+b) *a\ntmp = n%(a+b)\nans += min(tmp,a)\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s072191599', 's149478971', 's161168301', 's794035938', 's797663032']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 17.0]
[99, 153, 153, 116, 96]
p02754
u617556913
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=n - x*(a+b)\nif y >= a\n y=a\nprint(a*y+x)', 'n,a,b = map(int,input().split())\nx=n//(a+b)\ny=n - C1*(a+b)\nif y >= a:\n y=a\nprint(a*x+y)', 'n,a,b = map(int,input().split())\nx=n//(a+b)\ny=n - x*(a+b)\nif y >= a:\n y=a\nprint(a*x+y)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s722885287', 's862481842', 's199711625']
[9024.0, 8972.0, 9192.0]
[33.0, 31.0, 32.0]
[88, 88, 87]
p02754
u619398783
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()))\ncnt = 0\nc = n//(a+b)\nd = n%(a+b)\nif d <= a:\n cnt = c+d\nelse:\n cnt = c+a\nprint(cnt)', 'n,a,b = list(map(int,input().split()))\ncnt = 0\nc = n//(a+b)\nd = n%(a+b)\nif d <= a:\n cnt = a*c+d\nelse:\n cnt = a*c+a\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s476577353', 's874695090']
[2940.0, 2940.0]
[17.0, 18.0]
[123, 127]
p02754
u619455726
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 -*-\nimport math\nimport sys\na,b=map(int, input().split())\n\nx = math.floor(a/0.08)\n\ny = math.floor(b/0.1)\nif (x + 1) * 0.08 == a:\n xx = x + 2\nelse:\n xx = x + 1\n\nfor i in range(y,y+10):\n for j in range(x, xx):\n if i == j:\n print(i)\n sys.exit(0)\nprint(-1)\n ', '# -*- coding: utf-8 -*-\nn, a,b=map(int, input().split()) \nX = n//(a+b)\nY = n%(a+b)\nif Y > a:\n print(X*a + a)\nelse:\n print(X*a + Y)']
['Runtime Error', 'Accepted']
['s526822616', 's031607625']
[3060.0, 2940.0]
[19.0, 17.0]
[330, 136]
p02754
u619809897
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 N % (A + B) == 0:\n print(N // (A + B) * A)\nelif N % (A + B) - A < 0:\n print(N // (A + B) * A + abs(N % (A + B) - A)\nelif N % (A + B) - A > 0:\n print(N // (A + B) * A + A)', 'N,A,B = map(int, input().split())\n \nif N % (A + B) == 0:\n print(N // (A + B) * A)\nelif N % (A + B) - A < 0:\n print(N // (A + B) * A + abs(N % (A + B)))\nelif N % (A + B) - A > 0:\n print(N // (A + B) * A + A)']
['Runtime Error', 'Accepted']
['s148707504', 's929601712']
[2940.0, 3064.0]
[17.0, 18.0]
[213, 210]
p02754
u619850971
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 = 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']
['s025515480', 's763032689']
[2940.0, 2940.0]
[17.0, 18.0]
[95, 95]
p02754
u620846115
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)\nif c >a:\n print((n-c)*a/(a+b)+a)\nelse:\n print((n-c)*a/(a+b)+c)', 'n,a,b=map(int,input().split())\nc == n%(a+b)\nif c >a:\n print((n-c)*a/(a+b)+a)\nelse:\n print((n-c)*a/(a+b)+c)', 'n,a,b=map(int,input().split())\nc == n%(a+b)\nif c >a:\n print(a*(n//(a+b))+a)\nelif c <=a\n print(a*(n//(a+b))+c)', 'n,a,b=map(int,input().split())\nc = n%(a+b)\nd = n//(a+b)\nprint(a*d+min(a,c))']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s225127587', 's346963257', 's595402036', 's000081700']
[9032.0, 9100.0, 9028.0, 9072.0]
[31.0, 27.0, 30.0, 30.0]
[107, 108, 111, 75]
p02754
u625963200
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 n<=b:\n print(0)\nelse:\n ans=n - ((n//(a+b)) * (a+b))\n ans+=(n//(a+b)) * a\n print((n//(a+b)) * a)', 'n,a,b=map(int,input().split())\n\nans=n - ((n//(a+b)) * (a+b))\nans+=(n//(a+b)) * a\nprint((n//(a+b)) * a)', 'n,a,b=map(int,input().split())\n\nq,mod=divmod(n,a+b)\nmod=min(mod,a)\nprint(a*q + mod)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s175061245', 's280012205', 's742688760']
[3060.0, 2940.0, 3064.0]
[18.0, 18.0, 18.0]
[134, 102, 83]
p02754
u626228246
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(a)', 'n,a,b = map(int,input().split())\nm = a+b\nprint(a*(n//m)+min(a,n-((n//m)*m)))']
['Wrong Answer', 'Accepted']
['s345507961', 's846572308']
[2940.0, 9160.0]
[17.0, 29.0]
[41, 76]
p02754
u627213696
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 = N/(A+B)\na = N-(A+B)*s\nprint(int(A*s+a if A>a else A*(s+1)))', 'N,A,B = map(int,input().split())\ns = int(N/(A+B))\na = N-(A+B)*s\nprint(int(A*s+a if A>a else A*(s+1)))']
['Wrong Answer', 'Accepted']
['s295608409', 's053543048']
[2940.0, 3060.0]
[17.0, 17.0]
[96, 101]
p02754
u629350026
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())\ntemp=int(n/(a+b))*a\nif n-temp<=a:\n result=temp+a\nelse:\n result=temp+n\nprint(result)', 'n,a,b=map(int,input().split())\ntemp=int(n/(a+b))*a\nif n-int(n/(a+b))*(a+b)<=a:\n result=temp+a\nelse:\n result=temp+n-int(n/(a+b))*(a+b)\nprint(result)', 'n,a,b=map(int,input().split())\ntemp=int(n/(a+b))*a\nif n-temp>=a:\n result=temp+a\nelse:\n result=temp+n\nprint(result)', 'n,a,b=map(int,input().split())\ntemp=int(n/(a+b))*a\nif n-int(n/(a+b))*(a+b)>=a:\n result=temp+a\nelse:\n result=temp+n-int(n/(a+b))*(a+b)\nprint(result)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s480419146', 's599672664', 's666187405', 's350199488']
[3064.0, 3060.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0, 17.0]
[116, 149, 116, 149]
p02754
u629607744
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\nd=0\nif a==0:\n\tprint(0)\nelse:\n\tc=n//(a+b)\n\tprint(c)\n\td=a*c+n-c*(a+b)\n\tprint(d)', 'n,a,b=map(int,input().split())\nc=n//(a+b)\nd=0\nif a==0:\n\tprint(0)\nelse:\n\tif n>=(a+b):\n\t\tif n-c*(a+b)<=a:\n\t\t\td=a*c+n-c*(a+b)\n\t\t\tprint(d)\n\t\telse:\n\t\t\td=a*(c+1)\n\t\t\tprint(d)\n\telse:\n\t\tif n>=a:\n\t\t\tprint(a)\n\t\telse:\n\t\t\tprint(n)']
['Wrong Answer', 'Accepted']
['s278081558', 's333336184']
[3060.0, 3064.0]
[17.0, 18.0]
[112, 217]
p02754
u630027862
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())\nl = []\nl_a = ['b' for i in range(A)]\nl_b = ['r' for i in range(B)]\nfor val in range(N // (A + B)):\n l += l_a\n l += l_b\ncnt = 0\nfor val in range(N):\n if l[val] == 'b':\n cnt += 1\nprint(cnt)", 'N, A, B = map(int, input().split())\nx = N // (A + B)\ny = N % (A + B)\nif y < A:\n print(x*A + y)\nelse:\n print(x*A + A)']
['Runtime Error', 'Accepted']
['s349337343', 's568503997']
[530200.0, 2940.0]
[2285.0, 18.0]
[239, 122]
p02754
u631755487
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?
['"""\nB - Count Balls\n"""\n\nN, A, B = map(int, input().split(\' \'))\nliste = []\nbreak_flag = False\ncounter = 0\n\nfor i in range (10**100):\n if break_flag:\n break\n for j in range(A):\n counter += 1\n liste.append(\'b\')\n if counter == N:\n break_flag = True\n break\n if break_flag:\n break\n for j in range(B):\n counter += 1\n liste.append(\'r\')\n if counter == N:\n break_flag = True\n break\nprint(liste)\nprint(liste[:N+1].count(\'b\'))', '"""\nB - Count Balls\n"""\n\nN, A, B = map(int, input().split(\' \'))\nliste = []\nbreak_flag = False\ncounter = 0\n\nwhile counter < N:\n if break_flag:\n break\n for j in range(A):\n counter += 1\n liste.append(\'b\')\n if counter == N:\n break_flag = True\n break\n if break_flag:\n break\n for j in range(B):\n counter += 1\n liste.append(\'r\')\n if counter == N:\n break_flag = True\n break\nprint(liste)\nprint(liste[:N+1].count(\'b\'))', "N, A, B = map(int, input().split(' '))\nliste = []\nbreak_flag = False\ncounter = 0\na = 0\nb = 0\nwhile counter < N:\n a += A\n b += B\n counter += A+B\nif counter > N:\n for i in range(counter-N):\n if break_flag:\n break\n\n for j in range(B):\n b -= 1\n counter -= 1\n if counter == N:\n break_flag=True\n break\n if break_flag:\n break\n for j in range(A):\n a -= 1\n counter -= 1\n if counter == N:\n break_flag=True\n break", '"""\nB - Count Balls\n"""\n\nN, A, B = map(int, input().split(\' \'))\nkat = int(N/(A+B))\nkalan = N%(A+B)\n\na = A*kat\nif kalan > A:\n a += A\nelse:\n a += kalan\n\nprint(a)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s065341456', 's338813398', 's790123350', 's149362214']
[96536.0, 99224.0, 3064.0, 3060.0]
[2108.0, 2109.0, 2107.0, 17.0]
[527, 520, 590, 165]
p02754
u631998785
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())\nllist=[N]\nr=B\nb=A\nfor i in range(N-1 ):\n if b!=0:\n llist.append("blue")\n b=b-1\n elif r!=0:\n llist.append("red")\n r=r-1\n if r==0:\n b=A\n else : break\nprint(llist.count("blue"))', '\nn, a, b = map(int, input().split())\nperiod = a+b\ntimes = n//period\nk = n%period\nn = a if k >a else k\nprint(times*a + n)']
['Wrong Answer', 'Accepted']
['s116095239', 's040752128']
[91156.0, 2940.0]
[2108.0, 17.0]
[260, 121]
p02754
u634576930
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\nfor i in range(1,1100):\n if int(i*0.8)==A and int(i*0.1)==B:\n print(i)\n break\nelse:\n print(-1)\n', 'N, A, B = map(int,input().split())\n\nans = N//(A + B)*A\nrem = N%(A + B)\nans+=min(rem,A)\nprint(ans)']
['Runtime Error', 'Accepted']
['s300056155', 's152643972']
[2940.0, 2940.0]
[17.0, 17.0]
[146, 97]
p02754
u635540732
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\nwhile n>0:\n n-=a\n count+=min(a,n)\n n-=b\nprint(count)', 'n,a,b=map(int,input().split())\nc=a+b\nd=n//(a+b)\ne=n%(a+b)\nprint(a*d+min(e,a))']
['Wrong Answer', 'Accepted']
['s881274686', 's995847849']
[2940.0, 2940.0]
[2103.0, 17.0]
[94, 77]
p02754
u636845339
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==0:\n print('0')\nelif (a+b)*10**100 <=n:\n n=(a+b)*10**100\n \n \n amari=n%(a+b)\n cnt=int(n/(a+b))\n if amari<=a:\n print(cnt*a+amari)\n else:\n print(cnt*(a+1))\n", 'n,a,b=map(int,input().split())\namari=n%(a+b)\ncnt=n//(a+b)\nprint(cnt*a+min(amari,a))\n ']
['Wrong Answer', 'Accepted']
['s439709266', 's324613516']
[2940.0, 2940.0]
[18.0, 19.0]
[203, 86]
p02754
u642418876
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=ans+min(rem,A)\nprint(ans)']
['Runtime Error', 'Accepted']
['s873992495', 's167514843']
[2940.0, 3060.0]
[18.0, 17.0]
[85, 89]
p02754
u644546699
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?
['6 2 4', 'def resolve():\n N, A, B = map(int, input().split()) \n\n ao_count = 0\n\n count_num = N / (A + B)\n amari_num = N % (A + B)\n\n ao_count = count_num * A\n if amari_num <= A:\n ao_count += A\n\n\n print(ao_count)\n\n\n\nif __name__ == "__main__":\n resolve()', 'def resolve():\n N, A, B = map(int, input().split()) \n\n ao_count = 0\n\n count_num = N // (A + B)\n amari_num = N % (A + B)\n\n\n\n ao_count = count_num * A\n\n if A <= amari_num:\n ao_count += A\n else:\n ao_count += amari_num\n\n print(ao_count)\n\n\n\nif __name__ == "__main__":\n resolve()']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s063651083', 's500064484', 's283848518']
[2940.0, 3060.0, 3060.0]
[18.0, 17.0, 17.0]
[5, 272, 315]
p02754
u645436608
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 = 'b' * A + 'r' * B\nans *= N // (A + B)\nprint(ans.count('b'))", 'N,A,B=map(int,input().split())\ndiv=N//(A+B)\nmod=N%(A+B)\nprint(div*A+min(mod,A))']
['Runtime Error', 'Accepted']
['s006937624', 's941256946']
[3060.0, 2940.0]
[17.0, 17.0]
[101, 79]
p02754
u647679586
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: number of balls to take, A: blue, B: red\n N, A, B = list(map(int, input().split()))\n\n if N == 0:\n print(0)\n\n if A + B < N:\n # want to know how much A + B blocks can we place such that A + B < N (i.e. solve x(A+B) < N)\n blocks = int(N/(A+B))\n # for each block, there are A blue balls, plus potentially some reamining slots to fill the remaining space of N\n remaining_slots = N % (A+B)\n if A <= remaining_slots:\n # if it can fit A, place A more balls in the row\n print(blocks*A + A) \n else:\n print(blocks*A + remaining_slots)\n else:\n if A + B == N:\n print(A)\n else:\n print(A-N)', '# N: number of balls to take, A: blue, B: red\nN, A, B = list(map(int, input().split()))\n\n# Want to know m*A + n*B < N\ntotal = 0\nsingle_placements = A + B\n\nif A + B < N:\n # want to know how much A + B blocks can we place such that A + B < N (i.e. solve x(A+B) < N)\n blocks = N/(A+B)\n # for each block, there are A blue balls, plus potentially some reamining slots to fill the remaining space of N\n remaining_slots = N % (A+B)\n if remaining_slots >= A:\n # if it can fit A, place A more balls in the row\n print(blocks*A + A) \n else:\n print(blocks*A + (A-remaining_slots))\nelse:\n if A + B == N:\n print(A)\n else:\n print(A-N)', '# N: number of balls to take, A: blue, B: red\nN, A, B = list(map(int, input().split()))\n\nif N == 0:\n print(0)\n\nif A + B < N:\n # want to know how much A + B blocks can we place such that A + B < N (i.e. solve x(A+B) < N)\n blocks = int(N/(A+B))\n # for each block, there are A blue balls, plus potentially some reamining slots to fill the remaining space of N\n remaining_slots = N % (A+B)\n if A <= remaining_slots:\n # if it can fit A, place A more balls in the row\n print(blocks*A + A) \n else:\n print(blocks*A + remaining_slots)\nelse:\n if A < N:\n print(A)\n else:\n print(N)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s229041595', 's282504920', 's843611140']
[2940.0, 3064.0, 3060.0]
[18.0, 17.0, 17.0]
[714, 678, 631]
p02754
u647999897
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 solve():\n N, A, B = map(int, input().split())\n\n n_times = N // (A+B)\n amari = N % (A+B)\n cnt = 0\n # if amari != 0:\n # S = 'b' * A + 'r' * B\n # S = S[0:amari]\n\n # for ball in S:\n # if ball == 'b':\n # cnt += 1\n \n print(n_times * A + cnt)\n\nif __name__ == '__main__':\n solve()", "def solve():\n N, A, B = map(int, input().split())\n\n n_times = N // (A+B)\n amari = N % (A+B)\n\n cnt = 0\n if A <= amari:\n cnt = A\n else:\n cnt = amari\n \n print(n_times * A + cnt)\n\nif __name__ == '__main__':\n solve()"]
['Wrong Answer', 'Accepted']
['s343579050', 's250442896']
[2940.0, 3060.0]
[17.0, 17.0]
[347, 252]
p02754
u651822741
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?
['s = np.array(input().split()).astype(int)\n# =============================================================================\n# if s.find("A") >= 0 and s.find("B") >= 0:\n# print("Yes")\n# else:\n# print("No")\n# =============================================================================\n\nA,B,N = s\n\nprint((N//(A+B))*A+np.array(N%(A+B),A).max())', 'import numpy as np\n\ns = np.array(input().split()).astype(int)\n# =============================================================================\n# if s.find("A") >= 0 and s.find("B") >= 0:\n# print("Yes")\n# else:\n# print("No")\n# =============================================================================\n\nN,A,B = s\n\nprint(N//(A+B)*A + np.array([N%(A+B),A]).min())\n\n# =============================================================================\n# A,B = s\n# \n\n\n# x1 = A*eight\n# x2 = A*ten\n# if (int)(A * 10/8) != B:\n# print(-1)\n# else:\n# print(np.array(x1,x2).min().astype(int))\n# =============================================================================\n']
['Runtime Error', 'Accepted']
['s276027944', 's452157058']
[2940.0, 12416.0]
[17.0, 150.0]
[348, 703]
p02754
u652656291
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 = int(input())\na = str(input())\nb = str(input())\n\nL =[(a+b)*n]\n\nfor i in range(n+1):\n if a == 0:\n print(b*n)\n else:\n print(b.count(n))', 'N, A, B = map(int, input().split())\nans = N // (A + B) * A\nrem = N % (A + B)\nans += min(rem, A)\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s204650368', 's903565343']
[2940.0, 2940.0]
[17.0, 17.0]
[144, 107]
p02754
u652892331
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\nkaisu = int(n // (a+b))\namari = int(n % (a + b))\nans = kaisu * b\nif amari > b:\n ans += b\nelse:\n ans += amari\n\nprint(ans)', 'n, a, b = map(int, input().split())\n\nsho = int(n / (a + b))\namari = int(n % (a + b))\n\namari = min(a, amari)\n\nprint(sho * a + amari)']
['Wrong Answer', 'Accepted']
['s728722169', 's301002890']
[2940.0, 3060.0]
[19.0, 18.0]
[159, 131]
p02754
u655048024
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 = n//(a+b)\nh = min(a,n%(a+b))\nprint(k+h)\n', 'n,a,b = map(int,input().split())\nk = n//(a+b)\nh = min(a,n%(a+b))\nprint(a*k+h)\n']
['Wrong Answer', 'Accepted']
['s590448563', 's859809319']
[9136.0, 9084.0]
[31.0, 32.0]
[76, 78]
p02754
u657284954
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())\nsyo = n//(b+r)\namari = n%(b+r)\nprint(syo,amari)\nif amari == 0:\n print(b*syo)\nelse:\n if amari <= b:\n print(b*syo + amari)\n else:\n print(b*syo - (b-amari))', 'n,b,r = map(int,input().split())\nsyo = n//(b+r)\namari = n%(b+r)\nif amari == 0:\n print(b*syo)\nelse:\n if amari <= b:\n print(b*syo + amari)\n else:\n print(b*syo + b)']
['Wrong Answer', 'Accepted']
['s997698073', 's034742243']
[3060.0, 2940.0]
[18.0, 19.0]
[195, 170]
p02754
u657786757
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\nN,A,B = list(map(int,input().split()))\nans = math.ceil(A*(N/(A+B)))\nif N%(A+B)>=A:\n ans+=A\nelse: ans+=N%(A+B)\nprint(ans) ', 'import math\nN,A,B = list(map(int,input().split()))\nans = A*(N//(A+B))\nif N%(A+B)>=A:\n ans+=A\nelse: ans+=N%(A+B)\nprint(ans) ']
['Wrong Answer', 'Accepted']
['s225118679', 's438830100']
[3060.0, 3060.0]
[17.0, 17.0]
[136, 126]
p02754
u658288444
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())\nL=""\nfor _ in range(10**100):\n L += \'b\'*a+\'r\'*b\nprint(L[:n].count(\'b\'))', 'n,a,b=map(int,input().split())\nL=""\nfor _ in range(10**18):\n L += \'b\'*a+\'r\'*b\nprint(L[:n].count(\'b\'))', 'n,a,b=map(int,input().split())\nt= n//(a+b)\ns = n%(a+b)\nprint(t*a + min(s,a))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s541518106', 's690830998', 's403581211']
[2084340.0, 2040084.0, 2940.0]
[2240.0, 2257.0, 17.0]
[103, 102, 76]
p02754
u660899380
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())\npatternNum = N // (A + B)\nremains = N % (A + B)\nif (remains > A):\n\tprint(patternNum * A + A)\nelse:\n\tprint(patternNum * A)', 'N, A, B = map(int,input().split())\npatternNum = N // (A + B)\nremains = N % (A + B)\nif (remains > A):\n\tprint(patternNum * A + A)\nelse:\n\tprint(patternNum * A + remains)']
['Wrong Answer', 'Accepted']
['s939466818', 's439277465']
[2940.0, 2940.0]
[17.0, 17.0]
[156, 166]
p02754
u661343770
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?
['inp = input().split(" ")\nN,A,B = inp\nif (N%(A+B)) <= A:\n print((N/(A+B))*A + (N%(A+B)))\nelse:\n print((N/(A+B))*A + A)', 'inp = input().split(" ")\nN, A, B = (int(inp[0]), int(inp[1]), int(inp[2]))\nif int(N % (A + B)) <= A:\n print(int(N / (A + B)) * A + int(N % (A + B)))\nelse:\n print(int(N / (A + B)) * A + A)\n']
['Runtime Error', 'Accepted']
['s130751328', 's877076199']
[2940.0, 3060.0]
[19.0, 18.0]
[119, 194]
p02754
u664546626
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=n//(a+b)\nans1=a*s\nrem=n%(a+b)\nif rem>=a:\n print(ans1+a)\nelse:\n print(ans1+a-rem)\n ', 'n,a,b=map(int,input().split())\ns=n//(a+b)\nans1=a*s\nrem=n%(a+b)\nif rem>=a:\n print(ans1+a)\nelse:\n print(ans1+rem)']
['Wrong Answer', 'Accepted']
['s915482067', 's798959305']
[2940.0, 3060.0]
[17.0, 18.0]
[118, 113]
p02754
u666964944
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 y<a:\n print(a*(n//(a+b))+())\nelse:\n print(a*(n//(a+b)+1))\n', 'n,b,r = map(int, input().split())\n#if (n%(b+r)) < b: print((n//(b+r))*b+(n%(b+r)))\n#else: print((n//(b+r))*(b+1))\nans = n//(b+r)+b\nre = n%(b+r)\nans += min(re, ans)\nprint(ans)', 'n,a,b=map(int,input().split())\n#x=n//(a+b)\n#y=n%(a+b)\nif n%(a+b) < a: print(a*(n//(a+b))+(n%(a+b)))\nelse: print(a*((n//(a+b)+1)))\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s371591303', 's741030237', 's945358531']
[2940.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0]
[98, 174, 130]
p02754
u668705838
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\nresult = n // (a + b) * a\n\nrest = n - n // (a + b) * (a + b)\n\nif rest > a:\n result += rest - a\n\nprint(result)', 'n, a, b = map(int, input().split())\n\nresult = n // (a + b) * a + min (n % (a + b), a)\n\nprint(result)']
['Wrong Answer', 'Accepted']
['s809237635', 's778838200']
[2940.0, 2940.0]
[19.0, 17.0]
[149, 100]
p02754
u670180528
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)*a+min(a,n//%(a+b)))', 'n,a,b=map(int,input().split())\nprint(n//(a+b)*a+min(a,n%(a+b)))']
['Runtime Error', 'Accepted']
['s048876100', 's204791302']
[2940.0, 2940.0]
[17.0, 17.0]
[65, 63]
p02754
u670819023
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 n == 0:\n print(0)\nelif: a == 0:\n print(0)\nelif b == 0:\n print(n)\nelif a >= n:\n print(n)\nelif a+b > n > a:\n print(a)\nelse:\n q,mod = divmod(n, a+b)\n print(q*a + mod)', 'f a == 0:\n print(0)\nelif a > n:\n print(n)\nelif a+b > n:\n print(a)\nelse:\n q,mod = divmod(n, a+b)\n print(q*a + mod)', 'n,a,b = map(int, input().split())\n\nq, mod =divmod(n, a+b)\nprint(q*a + min(mod,a))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s426467381', 's793423397', 's094918517']
[3064.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[222, 128, 82]
p02754
u671446913
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?
['#!/usr/bin/env python3\n# = input()\n#a = int(input())\nn, a, b = map(int, input().split())\n# = list(map(int, input().split()))\n\n#\n# c = collections.Counter()\n\nif a == 0:\n print(0)\nelse:\n ans = (n // a) // 2\n if (n // (a + b)) % 2 == 1:\n ans += ans % n\n print(ans)\n', '#!/usr/bin/env python3\n# = input()\n#a = int(input())\nn, a, b = map(int, input().split())\n# = list(map(int, input().split()))\n\n#\n# c = collections.Counter()\n\nif a == 0:\n print(0)\nelif n < (a + b):\n print(min(n, a))\nelse:\n nab = n // (a + b)\n ans = nab * a\n mod = n % (nab * (a + b))\n ans += min(mod, a)\n print(ans)\n']
['Wrong Answer', 'Accepted']
['s255785276', 's326518300']
[2940.0, 3060.0]
[17.0, 17.0]
[311, 361]
p02754
u672316981
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 blue = 0\n\nblue1 = a * n // (a+b)\n\nn -= (a+b) * n // (a+b)\nblue2 = min(n, a)\n\nblue = blue1 + blue2\nprint(blue)', 'n, a, b = map(int, input().split())\nblue1 = a * n // (a+b)\n\nn -= (a+b) * n // (a+b)\nblue2 = min(n, a)\n\nblue = blue1 + blue2\nprint(blue)', 'n, a, b = map(int, input().split())\n\nif a==0:\n blue = 0\n\nelse:\n brset = n // (a+b)\n blue1 = a * brset\n n -= (a+b) * brset\n blue2 = min(n, a)\n blue = blue1 + blue2\n\nprint(blue)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s177883122', 's923862534', 's986672301']
[3060.0, 2940.0, 2940.0]
[18.0, 18.0, 17.0]
[159, 135, 193]