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
u024450350
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)\nballs = str()\n\nwhile len(balls) < n:\n for i in range(a):\n balls = balls + 'a'\n if len(balls) == n:\n break\n for i in range(b):\n balls = balls + 'b'\n if len(balls) == n:\n break\nprint(balls.count('a'))\n", 'n, a, b = map(int, input().split())\nunit = a + b\nunitCount = int(n / unit)\nrem = int(n % unit)\nif rem > a:\n rem = a\nprint(a * unitCount + rem)\n']
['Wrong Answer', 'Accepted']
['s238392855', 's622765808']
[12564.0, 2940.0]
[2104.0, 17.0]
[306, 146]
p02754
u025595730
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\ndef main()\n n, b, r = map(int, input().split())\n\n x = n // (b + r)\n\n if n % (b + r) > b:\n print(x * b + b)\n\n else:\n print((x * b) + (n % (b + r)))\n \n\nif __name__ == '__main__':\n main()\n ", '# coding: utf-8\n\nn, b, r = map(int, input().split())\n\nx = n // (b + r)\n\nif n % (b + r) > b:\n print(x * b + b)\n \nelse:\n print((x * b) + (n % (b + r)))\n']
['Runtime Error', 'Accepted']
['s392635254', 's917709590']
[2940.0, 2940.0]
[18.0, 19.0]
[228, 158]
p02754
u030410515
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['n,a,b=map(int,input().split())\n\nc=a+b\nif c==0:\n print(0)\nif a==0:\n print(0)\nif c!=0 and a!=0:\n d=n//c\n num=a*d\n if n%a<=b:\n print(num)\n else:\n print(num+n%a-b)\n', 'n,a,b=map(int,input().split())\n\nc=a+b\nif a==0:\n print(0)\nif c!=0 and a!=0:\n d=n//c\n num=a*d\n if n%c<=a:\n print(num+n%c)\n elif n%c>a:\n print(num+a)']
['Wrong Answer', 'Accepted']
['s633132807', 's775426345']
[2940.0, 3064.0]
[18.0, 21.0]
[192, 175]
p02754
u031115006
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 & B==0):\n print("0")\n\nelse:\n r=N//(A+B)\n s=N-A*r\n if(A<s):\n s=A\n if(A!=0):\n t=(A*r)+s\n else:\n t=0\n print(t)', 'N, A, B = map(int, input().split())\n\nr=N//(A+B)\ns=N%(A+B)\n\nif(B=0):\n t=N//A + N%A\n\nelse:\n if(A!=0):\n t=(A*r)+s\n else:\n t=0\n\nprint(t)', 'N, A, B = map(int, input().split())\n\nif(A==0 & B==0):\n print("0")\n\nelse:\n r=N//(A+B)\n s=N%(A+B)\n if(A<s):\n s=A\n if(A!=0):\n t=(A*r)+s\n else:\n t=0\n print(t)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s255172180', 's422737153', 's635162623']
[3060.0, 2940.0, 3060.0]
[17.0, 18.0, 17.0]
[168, 141, 170]
p02754
u031722966
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['def main():\n n,a,b = map(int,input().split())\n print((n // (a + b) ) * a + n % a)\nmain()', 'def main():\n N,A,B = map(int,input().split())\n bl = (N // (A + B)) * A\n rl = (N % (A + B))\n if rl <= A:\n print(bl + rl)\n else:\n print(bl + A)\nmain()']
['Runtime Error', 'Accepted']
['s710601399', 's594313353']
[2940.0, 2940.0]
[17.0, 17.0]
[94, 177]
p02754
u032222383
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['n,a,b=map(int, input().split())\nif n%(a+b)>b:\n print(n//(a+b)*a+n%(a+b))\nelif n%(a+b)==0:\n print(n//(a+b)*a)\nelse:\n print(n//(a+b)*a+a)', 'n,a,b=map(int, input().split())\nif n%(a+b)>a:\n print(n//(a+b)*a+a)\nelif n%(a+b)==0:\n print(n//(a+b)*a)\nelse:\n print(n//(a+b)*a+n%(a+b))']
['Wrong Answer', 'Accepted']
['s013060421', 's188175737']
[3060.0, 3060.0]
[18.0, 18.0]
[144, 144]
p02754
u032955959
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\nt=n//(a+b)\n\nprint(n-a*t-2*t*b)', 'n,a,b=map(int,input().split())\n\nt=n//(a+b)\n\nprint(t*a+min(a,n-t*(a+b)))\n']
['Wrong Answer', 'Accepted']
['s060454286', 's224603757']
[2940.0, 2940.0]
[17.0, 17.0]
[62, 72]
p02754
u034459102
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['N, A, B = list(map(int, input().split()))\n\ncount = - (-N // (A + B)) -1\namari = N%(A+B)\nsum_blue = A * max(count, 1) + min(A, amari)\nif N = 0: sum_blue = 0\nprint(sum_blue)', 'N, A, B = list(map(int, input().split()))\n\ncount = - (-N // (A + B)) -1\namari = N%(A+B)\nsum_blue = A * count + min(A, amari)\nif N >= A + B: sum_blue = A\nprint(sum_blue)', 'N, A, B = list(map(int, input().split()))\n\ncount = -(-N // (A + B)) -1\namari = N%(A+B)\nsum_blue = A * count + min(A, amari)\nprint(A * count)\nprint(amari)\nprint(sum_blue)', 'N, A, B = list(map(int, input().split()))\n\ncount = N // (A + B)\namari = N%(A+B)\nsum_blue = A * count + min(A, amari)\n\nprint(sum_blue)']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s234895783', 's315260545', 's708905878', 's589716226']
[2940.0, 3060.0, 3060.0, 2940.0]
[18.0, 17.0, 18.0, 19.0]
[171, 168, 169, 133]
p02754
u038408819
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['n, a, b = input().split()\nprint(min(n, a))', 'n, a, b = map(int, input().split())\ns = ""\nwhile len(s) <= n:\n s += \'b\' * a + \'r\' * b\ncnt = 0\nfor si in s[:n]:\n if si == \'b\':\n cnt += 1', 'n, a, b = map(int, input().split())\ndiv, rest =divmod(n, (a + b))\n#div, rest\nans = a * div\nif rest >= a:\n ans += a\nelse:\n ans += rest\nprint(ans)\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s156618063', 's181205792', 's773818418']
[2940.0, 1862516.0, 2940.0]
[17.0, 2239.0, 17.0]
[42, 148, 151]
p02754
u038887660
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['n, a, b = map(int, input().split())\nif a+b == 0:\n x = 0\nelse:\n\ts = n//(a+b)\n\tt = n%(a+b)\n if t <= a:\n \tx = s*a+t\n\telse:\n \tx = s*a+a\nprint(x)', 'n, a, b = map(int, input().split())\nif a+b == 0:\n x = 0\nelse:\n\ts = n//(a+b)\n\tt = n%(a+b)\n\tif t <= a:\n \tx = s*a+t\n\telse:\n \tx = s*a+a\nprint(x)', 'n, a, b = map(int, input().split())\nif a+b == 0:\n x = 0\nelse:\n\ts = n//(a+b)\n\tt = n%(a+b)\n\tif t <= a:\n\t\tx = s*a+t\n\telse:\n\t\tx = s*a+a\nprint(x)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s219989393', 's524300698', 's195242881']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[150, 147, 141]
p02754
u039934639
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\nline = 'b'*A + 'r'*B\n\nfor i in 10**100:\n line += line\n if len(line) >= N:\n break\n \nans = line.count('b')\nprint(ans)", 'N,A,B = map(int, input().split())\n\ncount = N//(A+B)\namari = N%(A+B)\n\nif amari < A:\n c = amari\nelse:\n c = A\n \nans = A * x + c\nprint(ans)', 'N,A,B = map(int, input().split())\n\ncount = N//(A+B)\namari = N%(A+B)\n\nif amari < A:\n c = amari\nelse:\n c = A\n \nans = A * count + c\nprint(ans)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s514680256', 's544286375', 's584565518']
[3060.0, 2940.0, 3064.0]
[17.0, 18.0, 17.0]
[157, 138, 143]
p02754
u043623523
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\ns=0\n\nif A==0:\n print(0)\nelse:\n a=N//(A+B)\n b=N%(A+B)\n\n # print(a)\n # print(b)\n if b>A:\n sum=A*a+A\n print(s)\n else:\n s=A*a+b\n print(s)', 'N,A,B=map(int,input().split())\n\n\nsum=0\n\nif A==0:\n print(0)\nelse:\n a=N//(A+B)\n b=N%(A+B)\n\n # print(a)\n # print(b)\n if b>=A:\n sum=A*a+A\n print(sum)\n if b<A:\n sum=A*a+b\n print(sum)\n']
['Runtime Error', 'Accepted']
['s456041236', 's728710649']
[2940.0, 2940.0]
[31.0, 18.0]
[199, 227]
p02754
u046158516
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-N%(A+B))*A/(A+B)+min(A,N%(A+B))\nprint(format(ans))\n', 'N, A, B=map(int, input().split())\nK=(N-N%(A+B))/(A+B)\nans=(K*A+min(A,N%(A+B))\nprint(int(round(ans)))\n', 'N,A,B=map(int, input().split())\nans=(N-N%(A+B))*A/(A+B)+min(A,N%(A+B))\nprint(ans)\n', 'N,A,B=map(int, input())\nans=(N-N%(A+B))*A/(A+B)+min(A,N%(A+B))\nprint(ans)', 'N, A, B=map(int, input().split())\nK=int((N-N%(A+B))/(A+B))\nans=(K*A+min(A,N%(A+B))\nprint(int(round(ans)))', 'N, A, B=map(int, input().split())\nK=int((N-N%(A+B))/(A+B))\nans=(K*A+min(A,N%(A+B)))\nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s030578900', 's049541799', 's359560699', 's414204514', 's948906092', 's797107241']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 17.0]
[92, 101, 82, 73, 105, 94]
p02754
u049182844
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
["n,a,b = map(int,input().split())\nbox = ''\nfor i in range(n//(a+b)+1):\n box += ('b' * a)\n box += ('r' * b)\nprint(box)\nprint(len([i for i in box[0:n] if i == 'b']))", 'n, a, b = map(int, input().split())\n\nans = n // (a + b) * a\n\nrem = n % (a + b)\n\nans += min(rem, a)\nprint(ans)']
['Runtime Error', 'Accepted']
['s565290610', 's358605431']
[2636712.0, 9164.0]
[2284.0, 29.0]
[164, 331]
p02754
u060694763
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['N, A, B = list(map(int, input().split()))\n\na = N // (A + B)\nm = N % (A + B)\n\nad = A if A > m else m\nif m == 0:\n ad = 0\nanswer = A * a + ad\nif A == 0:\n answer = 0\n\nprint(answer)\n', 'N, A, B = list(map(int, input().split()))\n\na = N // (A + B)\nm = N % (A + B)\n\nad = A if A < m else m\nif m == 0:\n ad = 0\nanswer = A * a + ad\nif A == 0:\n answer = 0\n\nprint(answer)\n']
['Wrong Answer', 'Accepted']
['s265495845', 's607616673']
[2940.0, 3060.0]
[17.0, 17.0]
[183, 183]
p02754
u063346608
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['N,A,B = map(int,input().split())\n\nc = N//(A + B)\n\nrem = N - c * (A + B)\n\nif rem >= A:\n\tsum = c * A + rem\nelse:\n\tsum =c + rem\n\nprint(sum)', 'N,A,B = map(int,input().split())\n\nnumber_turn = N //(A + B)\nnokori = N % (A + B)\n\nif nokori <= A: \n\tprint((number_turn * A) + nokori)\nelse:\u3000\n\tprint((number_turn * A) + A)', 'N,A,B = map(int,input().split())\n\nnumber_turn = N //(A + B)\nnokori = N % (A + B)\n\nif nokori <= A: \n\tprint((number_turn * A) + nokori)\nelse: \n\tprint((number_turn * A) + A)\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s102895106', 's215809054', 's854739238']
[2940.0, 9020.0, 9184.0]
[18.0, 25.0, 31.0]
[136, 231, 230]
p02754
u066551652
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)\n\ny = N % (A+B)\n\nans = x + min(A, y)\n\nprint(ans)', "N, A, B = map(int, input().split())\n\nX = N*(A*'b' + B*'r')\nprint(X)\n\ncnt = X.count('b', 0, N)\nprint(cnt)", "N, A, B = map(int, input().split())\n\nb = '1'\nr = '0'\n\nx =[]\ncnt = 0\nwhile len(x) < N:\n x.append(A*b)\n x.append(B*r)\n\nfor i in range(x):\n tmp = 0\n tmp = int(i)\n cnt += i\n\npint(cnt)", 'N, A, B = map(int,input().split())\n \nx = A * (N // (A+B))\n \ny = N % (A+B)\n \nans = x + min(A, y)\n \nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s456359237', 's538001944', 's703682973', 's085942009']
[2940.0, 3060.0, 2042996.0, 2940.0]
[18.0, 17.0, 2318.0, 18.0]
[98, 104, 184, 108]
p02754
u067983636
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']
['s915341803', 's594370726']
[9032.0, 9048.0]
[21.0, 31.0]
[80, 81]
p02754
u071916806
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['N,A,B=input().split()\nn=int(N)\na=int(A)\nb=int(B)\nm=n%(a+b)\nl=(n-m)/(a+b)\nif m>a:\n y=a\nelse:\n y=m\nx=a*l+y\nprint(x)', 'N,A,B=input().split()\nn=int(N)\na=int(A)\nb=int(B)\nm=int(n%(a+b))\nl=int((n-m)/(a+b))\nif m>a:\n y=a\nelse:\n y=m\nx=a*l+y\nx=int(x)\nprint(x)']
['Wrong Answer', 'Accepted']
['s353421327', 's019580226']
[2940.0, 3060.0]
[17.0, 18.0]
[115, 134]
p02754
u073606136
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\n\nnum, blue_num, red_num = map(int, input().split())\nall_ball = blue_num + red_num\nif blue_num == 0:\n print(0)\nelif red_num == 0:\n print(num)\nelse:\n count = int(math.floor(num / all_ball))\n rest = int(num - (count * all_ball))\n if rest <= blue_num:\n blue_rest = rest\n print((count * blue_num)a + blue_rest)\n', '# coding: utf-8\n\nnum, blue_num, red_num = map(int, input().split())\nall_ball = blue_num + red_num\nif num or blue_num == 0:\n print(0)\nelse:\n rest = int(num % all_ball)\n if rest <= blue_num:\n blue = rest\n count = int(num / all_ball)\n print((count) * blue_num + blue)\n\n', '# coding: utf-8\nimport math\n\ncount = 0\nnum, blue_num, red_num = map(int, input().split())\nall_ball = blue_num + red_num\ncount = num // (all_ball)\nrest = num % all_ball\nprint(count * all_ball + min(rest, blue_num))\n', '# coding: utf-8\n\nnum, blue_num, red_num = map(int, input().split())\nall_ball = blue_num + red_num\nif blue_num == 0:\n print(0)\nelse:\n rest = num % all_ball\n if rest <= blue_num:\n blue = rest\n count = num / all_ball\n print((count) * blue_num + rest)\n', '# coding: utf-8\nimport math\n\ncount = 0\nnum, blue_num, red_num = map(int, input().split())\nall_ball = blue_num + red_num\ncount = num // (all_ball)\nrest = n % all_ball\nprint(count * all_ball + min(rest, blue_num))\n', '# coding: utf-8\nimport math\n\ncount = 0\nnum, blue_num, red_num = map(int, input().split())\nall_ball = blue_num + red_num\ncount = num // all_ball\nrest = num % all_ball\nprint(count * blue_num + min(rest, blue_num))\n']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s097173017', 's417108928', 's485259876', 's857060443', 's891496979', 's743918371']
[8996.0, 9060.0, 9056.0, 9128.0, 9072.0, 9084.0]
[23.0, 28.0, 29.0, 30.0, 26.0, 28.0]
[359, 288, 214, 270, 212, 212]
p02754
u075303794
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['import sys\n\nreadline = sys.stdin.buffer.readline\n\nN,A,B = map(int, readline().split())\n\ndiv,mod =divmod(N, A+B)\nprint(div)\nprint(mod)\n\nif div < 1:\n if N > A:\n print(A)\n else:\n print(N)\nelse:\n print(A*div + A)\n ', 'import sys\n\nreadline = sys.stdin.buffer.readline\n\nN,A,B = map(int, readline().split())\n\ndiv,mod =divmod(N, A+B)\nprint(div)\nprint(mod)\n\nif div < 1:\n if N > A:\n print(A)\n else:\n print(N)\nelse:\n if mod > A:\n print(A*div + A)\n else:\n print(A*div + mod)\n ', 'import sys\n \nreadline = sys.stdin.buffer.readline\n \nN,A,B = map(int, readline().split())\n \ndiv,mod =divmod(N, A+B)\n \nif div < 1:\n if N > A:\n print(A)\n else:\n print(N)\nelse:\n if mod > A:\n print(A*div + A)\n else:\n print(A*div + mod)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s486359883', 's518388734', 's056685175']
[2940.0, 2940.0, 3060.0]
[18.0, 17.0, 17.0]
[220, 267, 246]
p02754
u077229945
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 count(b, total, N):\n remain = N%total\n if remain < b:\n return remain\n else:\n return b\n \nN, b, r = [int(i) for i in data.split()]\n\nball = int(N/total) * b + count(b, b+r, N)\nprint(ball)', 'def count(b):\n remain = N%total\n if remain < b:\n return remain\n else:\n return b\n \n \ndata = input()\n\nN, b, r = [int(i) for i in data.split()]\n\nball = int(N/total) * b + count()\nprint(ball)', 'def count(b, total, N):\n remain = N%total\n if remain < b:\n return remain\n else:\n\t\treturn b\n\ndata = input()\nN, b, r = [int(i) for i in data.split()]\n\nball = int(N/total) * b + count(b, b+r, N)\nprint(ball)', 'def count(b, total, N):\n remain = N%total\n if remain < b:\n return remain\n else:\n return b\n\ndata = input()\nN, b, r = [int(i) for i in data.split()]\n \nball = int(N/total) * b + count(b, b+r, N)\nprint(ball)', 'def count(b, total, N):\n remain = N%total\n if remain < b:\n return remain\n else:\n return b\n \ndata = input()\nN, b, r = [int(i) for i in data.split()]\n \nball = int(N/total) * b + count(b, b+r, N)\nprint(ball)', 'def count(b, total, N):\n r = N%total\n if r < b:\n return r\n else:\n return b\n\ndata = input()\nN, b, r = [int(i) for i in data.split()]\n\ntotal = b + r\n\nball = int(N/total) * b + count(b, total, N)\nprint(ball)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s440597668', 's534917449', 's640901840', 's926224563', 's970975414', 's785328560']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 3060.0]
[17.0, 18.0, 17.0, 19.0, 18.0, 17.0]
[216, 215, 219, 226, 232, 213]
p02754
u077291787
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?
['# C - Tax Increase\nfrom math import floor\n\n\ndef calc(a: int, b: int) -> int:\n for i in range(1, 1010):\n if floor(i * 0.08) == a and floor(i * 0.1) == b:\n return i\n return -1\n\n\ndef main():\n A, B = map(int, input().split())\n print(calc(A, B))\n\n\nif __name__ == "__main__":\n main()\n', '# B - Count Balls\ndef main():\n N, A, B = map(int, input().split())\n ans = N // (A + B) * A + min(A, N % (A + B))\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n']
['Runtime Error', 'Accepted']
['s373302305', 's544719523']
[3060.0, 2940.0]
[17.0, 17.0]
[311, 174]
p02754
u078349616
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\nt = N // (A + B)\nif N % (A + B) == 0:\n mod = 0\nelse:\n mod = A\n\nprint(t * A + mod)', 'N, A, B = map(int, input().split())\n\nt = N // (A + B)\nmod = N % (A + B)\n\nprint(t * A + min(mod, A))']
['Wrong Answer', 'Accepted']
['s138359497', 's721689038']
[2940.0, 2940.0]
[18.0, 17.0]
[120, 99]
p02754
u078957995
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['N, A, B = map(int, input().split())\n\nq, mod = divmod(N, A+B)\nprint(q, mod)\n\nif A < mod:\n\tmod_A = A\nelse:\n\tmod_A = mod\n\nprint(A * q + mod_A)\n', 'N, A, B = map(int, input().split())\n\nq, mod = divmod(N, A+B)\n\nif A < mod:\n\tmod_A = A\nelse:\n\tmod_A = mod\n\nprint(A * q + mod_A)\n']
['Wrong Answer', 'Accepted']
['s950394937', 's634506480']
[2940.0, 2940.0]
[17.0, 18.0]
[140, 126]
p02754
u080200554
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 = [int(x) for x in input().split()]\n \nif (b < a):\n temp = b\n b = a\n a = temp\n \n \nx = 1\nwhile True:\n if (int(x*0.08) == a and int(x*0.1) == b):\n print(x)\n break\n else:\n if (x > 1500):\n print(-1)\n break\n else:\n x += 1', 'n, 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)']
['Runtime Error', 'Accepted']
['s016252473', 's411984028']
[3060.0, 2940.0]
[17.0, 18.0]
[296, 120]
p02754
u083960235
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
["import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\n \ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef S_MAP(): return map(str, input().split())\ndef LIST(): return list(map(int, input().split()))\ndef S_LIST(): return list(map(str, input().split()))\n \nsys.setrecursionlimit(10 ** 9)\nINF = float('inf')\nmod = 10 ** 9 + 7\n\nn, a, b = MAP()\n\n# x = n // (a + b)\n# pr/int(x)\nx = 0\nx += (n // (a + b)) * a\nx += (n % (a+b)) % b\nprint(x)", "import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom heapq import heapify, heappop, heappush\n \ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef S_MAP(): return map(str, input().split())\ndef LIST(): return list(map(int, input().split()))\ndef S_LIST(): return list(map(str, input().split()))\n \nsys.setrecursionlimit(10 ** 9)\nINF = float('inf')\nmod = 10 ** 9 + 7\n\nN, A, B = MAP()\n\na = N % (A + B)\nb = N // (A + B)\nc = 0\n\nif 0 <= a <= A:\n c = a\nelse:\n c = A\n\nprint(b * A + c)"]
['Runtime Error', 'Accepted']
['s251891443', 's857816153']
[5712.0, 3944.0]
[57.0, 27.0]
[813, 841]
p02754
u084261177
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?
['# place A blue balls first,\n# then place B red balls after\n# go until you get to N\nn, a, b = map(int, input().split())\nx = 1\nwhile a * x + b * x < n:\n x += 1\nprint(a * x)\n# if (a * x + b * x) - n > b:\n\n', 'n, a, b = map(int, input().split())\nx = max(n // (a + b) - 2, 1)\nwhile a * x + b * x < n:\n temp = a * x + b * x\n x += 1\ntemp = a * x + b * x\nif temp - b >= n:\n temp = temp - b\n print(a * x - (temp - n))\nelse:\n print(a * x)\n']
['Wrong Answer', 'Accepted']
['s738219143', 's753188073']
[2940.0, 2940.0]
[2104.0, 18.0]
[215, 238]
p02754
u086438369
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+b <= n:\n print(a)\nelif n%(a+b) <= a:\n print((n//(a+b))*a + n%(a+b))\nelse:\n print((n//(a+b))*a + a)', 'n, a, b = map(int, input().split())\n\nif a >= n:\n print(n)\nelif a+b >= n:\n print(a)\nelif n%(a+b) <= a:\n print((n//(a+b))*a + n%(a+b))\nelse:\n print((n//(a+b))*a + a)\n']
['Wrong Answer', 'Accepted']
['s466186925', 's755547521']
[3060.0, 2940.0]
[17.0, 17.0]
[143, 168]
p02754
u089230684
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()\ni=0;c=0\na=input()\nb=input()\nwhile True:\n for j in range(a):\n if i >= n:break\n i+=1\n c+=1\n for j in range(b):\n i+=1\n if i > n:break\nprint(c)', 'n, a, b = map(int, input().strip().split())\nq, r = divmod(n, a+b)\nblue = a*q\nif r < a:\n blue += r\nelse:\n blue += a\nprint(blue)']
['Runtime Error', 'Accepted']
['s569089957', 's890108078']
[2940.0, 2940.0]
[19.0, 18.0]
[186, 132]
p02754
u089376182
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\ns = 'b'*a+'r'*b\nind = n%(a+b) \n\nprint(s[ind-1])", 'n,a,b = map(int, input().split())\n\nans = n//(a+b)*a \nx = n%(a+b) \n\nif x<=a:\n ans += x\nelse:\n ans += a\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s083584667', 's022185202']
[3060.0, 2940.0]
[17.0, 17.0]
[82, 115]
p02754
u091307273
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['n, a, b = [int(i) for i in input().split]\n\nif a + b == 0:\n print(0)\nelse:\n c, r = n // (a + b), n % (a + b)\n nblue = c * a + min(a, r)\n print(nblue)\n', 'def main():\n n, a, b = [int(i) for i in input().split()]\n\n if a + b == 0:\n print(0)\n else:\n c, r = n // (a + b), n % (a + b)\n nblue = c * a + min(a, r)\n print(nblue)\n\nmain()\n']
['Runtime Error', 'Accepted']
['s583529989', 's948015798']
[8928.0, 9192.0]
[24.0, 26.0]
[153, 211]
p02754
u091852005
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())\nquot = N // (A + B)\nresid = N % (A + B)\nif resid:\n print(quot * A + max(resid, A))\nelse:\n print(quot * A )', 'N, A, B = map(int, input().split())\nquot = N // (A + B)\nresid = N % (A + B)\nif resid:\n print(quot * A + min(resid, A))\nelse:\n print(quot * A )']
['Wrong Answer', 'Accepted']
['s770162745', 's199381467']
[2940.0, 2940.0]
[17.0, 18.0]
[148, 148]
p02754
u094999522
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['n,a,b=map(int,input().split())\np,q=divmod(n,(a+b))\nprint(p*b + [b,q][q<b]) ', 'n,a,b=map(int,input().split())\np,q=divmod(n,(a+b))\nprint(p*a + [a,q][q<a])']
['Wrong Answer', 'Accepted']
['s487702373', 's096381499']
[2940.0, 2940.0]
[17.0, 17.0]
[75, 74]
p02754
u102223485
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\nN, A, B = map(int, input().split())\n\nlst = []\nfor i in range(A):\n lst.append("b")\nfor i in range(B):\n lst.append("r")\n# print("lst:", lst)\n\nif len(lst) >= N:\n lst = lst[:N]\n print(lst.count(\'b\'))\nelse:\n lst2 = []\n while len(lst2) < N:\n lst2 += lst\n lst = lst[:N]\n print(lst.count(\'b\'))', '# coding: utf-8\nN, A, B = map(int, input().split())\n\nif A == 0:\n print(0)\nelse:\n B = A + B\n q, mod = divmod(N, B)\n num = q * A + mod', '# coding: utf-8\nimport numpy as np\nN, A, B = map(int, input().split())\nprint("N:", N, "A:", A, "B:", B)\nif A == 0:\n print(0)\nelif B == 0:\n print(N)\nelif N <= A:\n print(N)\nelif N <= A + B:\n print(A)\nelse:\n lst = np.array([1 for i in range(A)])\n # print(lst)\n lst2 = np.array([0 for i in range(B)])\n # print(lst2)\n lst3 = np.append(lst, lst2)\n # print(lst3)\n while lst3.size < N:\n lst3 = np.append(lst3, lst3)\n lst3 = lst3[:N]\n print(np.count_nonzero(lst3 == 1))', '# coding: utf-8\nN, A, B = map(int, input().split())\n\nif A == 0:\n print(0)\nelif B == 0 or N <= A:\n print(N)\nelse:\n num = int(N / (A + B)) * A + min(A, N % (A + B))\n print(num)\n']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s046808479', 's523655800', 's802483870', 's700436271']
[196120.0, 2940.0, 510008.0, 2940.0]
[2294.0, 17.0, 2137.0, 17.0]
[370, 182, 506, 222]
p02754
u102242691
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())\nnum = 0\nnum = n // (a+b)\n\nif n % (a+b) <= a:\n print((n*a)+ (n % (a+b)))\nelse:\n print((n*a)+a)\n\n', '\nn,a,b = map(int,input().split())\nnum = 0\nnum = n // (a+b)\n\nif n % (a+b) <= a:\n print((num*a)+ (n % (a+b)))\nelse:\n print((num*a)+a)\n\n']
['Wrong Answer', 'Accepted']
['s107579697', 's111371940']
[3060.0, 2940.0]
[18.0, 17.0]
[135, 139]
p02754
u105302073
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()]\nx = n // (a + b)\nmod = n % (a + b)\ndiff = abs(a - b)\n\nprint(diff, x, mod)\nif diff >= mod:\n print(a * x + mod)\nelse:\n if n % 2 == 0:\n print(a * (x + 1))\n else:\n print(a * x + mod)\n', 'n, a, b = [int(i) for i in input().split()]\nans = (n // (a + b)) * a\nrem = n % (a + b)\nprint(ans, rem, a)\nans += min(rem, a)\nprint(ans)\n', 'n, a, b = [int(i) for i in input().split()]\nx = n // (a + b)\nmod = n % (a + b)\nif a <= b:\n print(a * (x + 1))\nelse:\n print(a * x + mod)\n', 'n, a, b = [int(i) for i in input().split()]\nans = (n // (a + b)) * a\nrem = n % (a + b)\nprint(ans, rem, a)\nans += min(rem, a)\nprint(ans)\n', 'n, a, b = [int(i) for i in input().split()]\nans = (n // (a + b)) * a\nrem = n % (a + b)\nans += min(rem, a)\nprint(ans)\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s336496158', 's459100800', 's586274717', 's727413582', 's269002030']
[2940.0, 3064.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 17.0]
[246, 136, 142, 136, 117]
p02754
u106181248
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['n, a, b = map(int,input().split())\n \nx = int(n/(a+b)) \ny = n%(a+b)\n\nif y > a:\n ans = (x+1) * a\nelse:\n x * a + y\n\nprint(ans)', 'n, a, b = map(int,input().split())\n\nx = int((a+b)/n) \ny = (a+b)%n \nans = x * a + y\n\nprint(ans)', 'n, a, b = map(int,input().split())\n \nx = int(n/(a+b)) \ny = n%(a+b) \n\nif y > a:\n ans = (x+1) * a\nelse:\n ans = x * a + y\n\nprint(ans)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s305872533', 's645582242', 's653645230']
[3060.0, 2940.0, 3060.0]
[18.0, 17.0, 17.0]
[142, 107, 156]
p02754
u108136854
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, a = map(int, input().split())\nprint(n // (a + b) * b + min(n % (a + b), b)', 'n, b, a = map(int, input().split())\nprint(n // (a + b) * b + min(n % (a + b), b))']
['Runtime Error', 'Accepted']
['s473437070', 's885446080']
[2940.0, 2940.0]
[17.0, 17.0]
[80, 81]
p02754
u113255362
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['a,b,c=map(int,input().split())\nn = a // (b+c)\nm = a - (b+c)*n\nres = n*b\nif b < m:\n res += m\nelse:\n res += b\nprint(res)', 'a,b,c=map(int,input().split())\nn = a // (b+c)\nm = a - (b+c)*n\nres = n*b\nif m < b:\n res += m\nelse:\n res += b\nprint(res)']
['Wrong Answer', 'Accepted']
['s228325025', 's000285527']
[9044.0, 9116.0]
[25.0, 28.0]
[120, 120]
p02754
u113341986
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?
["args = input()\nnums = args.split(' ')\nif int(nums[0]) < int(nums[1]):\n print(nums[0])\n exit()\nprint(nums[1])", "args = input()\nnums = args.split(' ')\nn = int(nums[0])\na = int(nums[1])\nb = int(nums[2])\nblue_calc = int(n / (a + b))\nblue_mod = n % (a + b)\nif blue_mod < a:\n print(a * blue_calc + blue_mod)\n exit()\nprint(a * blue_calc + a) "]
['Wrong Answer', 'Accepted']
['s156276908', 's235525690']
[2940.0, 3064.0]
[17.0, 17.0]
[110, 228]
p02754
u113991073
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()))\nx=0\nif n-a-b>0 and b!=0:\n x=n-a-b\n b=b+x\nprint(b)', 'n,a,b=list(map(int,input().split()))\nx=0\nif n-a-b>0:\n x=n-a-b\n b=b+x\nprint(b)', 'n,b,r=list(int,input().split())\n\nm=n%(b+r)\nl=n//(b+r)\n\nif m<b:\n s=b\nelse:\n s=m\n\nif m!=0:\n n_b=l*b+s\nelse:\n n_b=l*b\n\nprint(n_b)', 'n,a,b=list(map(int,input().split()))\nx=0\nif n-a-b>0 and a!=0:\n x=n-a-b\n b=b+x\nprint(b)', 'n,a,b=list(map(int,input().split()))\n\nx=0\nif a==0:\n x=0\nelif n<a+b:\n x=b\nelse:\n x=n-a\n\nprint(x)', 'n,b,r=list(map(int,input().split()))\n\nm=n%(b+r)\nl=n//(b+r)\n\nif m<b:\n s=b\nelse:\n s=m\n\nif m!=0:\n n_b=l*b+s\nelse:\n n_b=l*b\n\nprint(n_b)', 'n,b,r=list(map(int,input().split()))\n\nm=n%(b+r)\nl=n//(b+r)\nx=n-l*(b+r)\n\nif x<b:\n s=m\nelse:\n s=b\n\nif m==0:\n n_b=l*b\nelse:\n n_b=l*b+s\nprint(n_b)']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s261485916', 's354692821', 's496036500', 's602571154', 's877589936', 's939946479', 's514146983']
[2940.0, 2940.0, 2940.0, 3064.0, 2940.0, 3060.0, 3060.0]
[17.0, 18.0, 17.0, 18.0, 17.0, 18.0, 17.0]
[92, 83, 138, 92, 104, 143, 154]
p02754
u115110170
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\nprint(n/(a+b)*a + min(a,n%(a+b)))', 'n,a,b= map(int,input().split())\n\nprint(n//(a+b)*a + min(a,n%(a+b)))\n']
['Wrong Answer', 'Accepted']
['s592841091', 's295814695']
[3064.0, 2940.0]
[17.0, 18.0]
[66, 68]
p02754
u122216125
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['def main():\n n, a, b = list(map(int, input().split()))\n if a == 0:\n return 0\n if b == 0:\n return n\n if n <= a:\n return n\n if (a + b) >= n:\n return a\n \n temp = n - a\n set_count = temp // (a + b)\n mod = temp % (a + b)\n blue_in_mod = 0 if mod <= b else mod - b\n \n return a + (set_count * a) + blue_in_mod', 'def main():\n n, a, b = list(map(int, input().split()))\n if a == 0:\n return 0\n if b == 0:\n return n\n if n <= a:\n return n\n if (a + b) >= n:\n return a\n \n temp = n - a\n set_count = temp // (a + b)\n mod = temp % (a + b)\n blue_in_mod = 0 if mod <= b else mod - b\n \n return a + (set_count * a) + blue_in_mod\n\nprint(main())']
['Wrong Answer', 'Accepted']
['s916675062', 's742059478']
[3064.0, 3064.0]
[17.0, 18.0]
[325, 340]
p02754
u124415435
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 = map(int,input().split())\ncount = max(N % (blue+red), blue)\ncount += int(N/(blue+red)) * blue\nprint(count)', 'N, blue, red = map(int,input().split())\ncount = min(N % (blue+red), blue)\ncount += int(N/(blue+red)) * blue\nprint(count)']
['Wrong Answer', 'Accepted']
['s200575114', 's288274684']
[2940.0, 2940.0]
[17.0, 17.0]
[120, 120]
p02754
u127288756
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())\nsho,ama=divmod(N,a+b)\nprint(N*sho+min(ama,a))', 'N,A,B = map(int, input().split())\nsho,ama=divmod(N,A+B)\nprint(A*sho+min(ama,A))']
['Runtime Error', 'Accepted']
['s571399417', 's336021630']
[2940.0, 2940.0]
[17.0, 18.0]
[76, 79]
p02754
u127332066
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\nnum = input().split()\nn, b, r = [int(N) for N in num]\n\ntime=0\nwhile n>0:\n time += 1\n n -= b\n if n<=0:\n print(b * time + n)\n n -= r\n if n<=0:\n print(b * time)', '# coding: utf-8\n\nnum = input().split()\nn, b, r = [int(N) for N in num]\n\nn = n % (b+r)\nif n>b:\n print((int(n / (b+r))+1) * b)\nelse:\n print((int(n / (b+r))+1) * b - n)', '# coding: utf-8\n\nnum = input().split()\nN, b, r = [int(N) for N in num]\n\nn = N % (b+r)\nif n>b:\n print(int(N / (b+r)) * b + b)\nelse:\n print(int(N / (b+r)) * b + n)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s336476248', 's774674075', 's589973952']
[3060.0, 3060.0, 2940.0]
[2104.0, 17.0, 17.0]
[203, 171, 167]
p02754
u131406572
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())\nimport math\nx=math.floor(n/(a+b))\nprint(x*a+max(a,n-x*(a+b)))', 'n,a,b=map(int,input().split())\nimport math\nx=math.floor(n/(a+b))\nprint(x*a+min(a,n-x*(a+b)))']
['Wrong Answer', 'Accepted']
['s693523257', 's413293144']
[2940.0, 3064.0]
[17.0, 17.0]
[92, 92]
p02754
u132049876
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())\nrepeat = N / (A+B)\nmod = N % (A+B)\nprint(A*repeat + min(A, mod))', 'N, A, B = map(int, input().split())\nrepeat = N // (A+B)\nmod = N % (A+B)\nprint(A*repeat + min(A, mod))']
['Wrong Answer', 'Accepted']
['s978200940', 's015136485']
[2940.0, 2940.0]
[17.0, 17.0]
[100, 101]
p02754
u137808818
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%(a+b)\nprint(x*a+y)\n ', 'n,a,b = map(int,input().split())\nans=n//(a+b)*a\nx=n%(a+b)\nans+=min(x,a)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s917072820', 's084898213']
[2940.0, 2940.0]
[17.0, 17.0]
[73, 82]
p02754
u143492911
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['# A = [list(map(int, input().split())) for _ in range(3)]\n# n = int(input())\n# B = [int(input()) for _ in range(n)]\n# X = list(map(int, input().split()))\nn, b, r = map(int, input().split())\ntotal = b+r\ncircle = total//n\ndiff = n % total\nif b < diff:\n print(diff + circle*b)\nelse:\n print(b + circle*b)\n', '# A = [list(map(int, input().split())) for _ in range(3)]\n# n = int(input())\n# B = [int(input()) for _ in range(n)]\n# X = list(map(int, input().split()))\nn, b, r = map(int, input().split())\ntotal = b+r\ncircle = n//total\ndiff = n % total\nif b <= diff:\n print(b + circle*b)\nelse:\n print(diff + circle*b)\n']
['Wrong Answer', 'Accepted']
['s570989101', 's773194602']
[2940.0, 2940.0]
[18.0, 17.0]
[307, 308]
p02754
u148753842
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?
['count = 0\ni = 0\nwhile (n>i):\n for bi in range(b):\n count += 1\n i += 1\n if n <= i:\n break\n for ri in range(r):\n i += 1\n if n<=i:\n break\nprint(count)', 'count = 0\ni = 0\nwhile (n>i):\n for bi in range(b):\n count += 1\n i += 1\n if n <= i:\n break\n for ri in range(r):\n i += 1\n if n<=i:\n break\nprint(count)', 'n, b, r = map(int, input().split())\ni = 0\nhoge = n // (b+r)\ncount = hoge*b\nn = n - hoge*(b+r)\nif n == 0:\n print(count)\nwhile (n>i):\n count += b\n i += b\n if n<=i:\n print(count - (i-n))\n break\n i += r\n if n<=i:\n print(count)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s260640036', 's490977098', 's826293462']
[2940.0, 2940.0, 3064.0]
[17.0, 17.0, 19.0]
[210, 210, 261]
p02754
u148856702
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)+min(n%(a+b),a)', 'n,a,b = map(int,input().split())\nprint((n//(a+b))*a+min(n%(a+b),a))']
['Runtime Error', 'Accepted']
['s330510495', 's138042935']
[2940.0, 2940.0]
[17.0, 18.0]
[64, 67]
p02754
u153188481
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\n2 ans = N // (A + B) * A\n\n3 rem = N % (A + B)\n\n4 ans += min(rem, A)\n\n5 print(ans)', 'N, A, B = map(int, input().split())\nans = N // (A + B) * A\nrem = N % (A + B)\nans += min(rem, A)\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s425255378', 's114905560']
[2940.0, 2940.0]
[18.0, 17.0]
[118, 107]
p02754
u161485415
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
[' N,A,B = map(int,input().split())\n \n \n i = N // (A+B)\n b = i*A\n t = N % (A+B)\n\n if t > A:\n t = A\n\n print(b+t)', 'N,A,B = map(int,input().split())\n\n\ni = N // (A+B)\nb = i*A\nt = N % (A+B)\nif t > A:\n t = A\nprint(b+t)']
['Runtime Error', 'Accepted']
['s802658762', 's889626946']
[8808.0, 9096.0]
[24.0, 31.0]
[156, 117]
p02754
u163874353
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 = ""\ncnt = 0\nfor i in range(10 **100):\n n1 = "b" * A\n n2 = "r" * B\n l += n1 + n2\n for j in range(N):\n if j == "b":\n cnt += 1\nprint(cnt)', 'n, a, b = map(int,input().split())\nif a == 0 and b == 0:\n print(0)\nif a != 0 or b != 0:\n \n kumi = n // (a + b)\n nokori = n % (a + b)\n if nokori == 0:\n print(a * kumi)\n elif nokori >= 1 and nokori < a:\n print(a * kumi + nokori)\n elif nokori >= a:\n print(a * kumi + a)']
['Runtime Error', 'Accepted']
['s852329836', 's713856409']
[13716.0, 3064.0]
[2108.0, 18.0]
[201, 313]
p02754
u165368960
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\n\nN, A, B = map(int, input().split())\nx = math.floor(N // (A + B))\ny = N % (A + B)\n\nprint(x)\n\nif y >= A:\n print(A * x + A)\nelse:\n print(A * x + y)', 'import math\n\nN, A, B = map(int, input().split())\nx = math.floor(N // (A + B))\ny = N % (A + B)\n\nprint(A * x + min(A, y))']
['Wrong Answer', 'Accepted']
['s905643737', 's643057613']
[3060.0, 3060.0]
[17.0, 18.0]
[159, 119]
p02754
u166727624
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\nimport sys\n\n\ndef solve(N: int, A: int, B: int):\n\n # if A+B < N : N = A+B\n if N <= A : print(N)\n else : \n k = N // (A+B)\n rem = N - (A+B)*k\n b_ = A - rem\n if b_ >= 0: print(k*A+rem+1)\n else : print(k*A)\n\n\n return\n\n\n# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n A = int(next(tokens)) # type: int\n B = int(next(tokens)) # type: int\n solve(N, A, B)\n\nif __name__ == '__main__':\n main()\n", '#!/usr/bin/env python3\nimport sys\n \n \ndef solve(N: int, A: int, B: int):\n \n # if A+B < N : N = A+B\n if N <= A : print(N)\n else : \n k = N // (A+B)\n rem = N - (A+B)*k\n b_ = A - rem\n if b_ >= 0: print(k*A+rem+1)\n else : print(k*A)\n \n \n return\n \n \n# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n A = int(next(tokens)) # type: int\n B = int(next(tokens)) # type: int\n solve(N, A, B)\n \nif __name__ == ', "#!/usr/bin/env python3\nimport sys\n\n\ndef solve(N: int, A: int, B: int):\n\n if N <= A : print(N) \n else :\n k = N // (A+B)\n rem = N - (A+B)*k\n if rem >= A:\n print(k*A+A)\n elif rem >= 0:\n print(k*A+rem)\n else : print(k*A)\n\n\n return\n\n\n# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n A = int(next(tokens)) # type: int\n B = int(next(tokens)) # type: int\n solve(N, A, B)\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Runtime Error', 'Accepted']
['s826254271', 's843631850', 's209494200']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 18.0]
[790, 775, 804]
p02754
u166807268
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
["#include<bits/stdc++.h>\nusing namespace std;\nint main(){\n string S ;\n int Q;\n string query1,query;\n cin>>S;\n cin>>Q;\n for(int i = 1; i <= Q;i++){\n getline(cin, query1);\n query = query1;\n if(query[0]=='1'){\n reverse(S.begin(), S.end()); \n }else{\n if(query[2]=='1'){\n S = query[4] + S;\n }else\n {\n S = S + query[4];\n }\n \n }\n }\n cout<<S<<endl;\n\treturn 0;\n}", 'n, 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)']
['Runtime Error', 'Accepted']
['s886870388', 's504161722']
[2940.0, 3064.0]
[18.0, 18.0]
[507, 120]
p02754
u172251139
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?
['text = list(map(int, input().split()))\n\nreply = 0\ncolor_blue = True\ncolor_num = 0\nfor i in range(text[0]):\n if color_blue == True:\n if color_num < text[1]:\n color_num += 1\n reply += 1\n else:\n color_blue = False\n color_num = 0\n else:\n if color_num < text[2]:\n color_num += 1\n else:\n color_blue = True\n color_num = 0\n\nprint(reply)', 'text = list(map(int, input().split()))\n\nreply = text[0] // (text[1] + text[2]) * text[1]\n\nreply += text[1] if text[0] % (text[1] + text[2]) > text[1]else text[0] % (text[1] + text[2])\n\nprint(reply)']
['Wrong Answer', 'Accepted']
['s037654567', 's102076303']
[3060.0, 3060.0]
[2104.0, 17.0]
[439, 197]
p02754
u173644182
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['def main():\n n, a, b = map(int, input().split())\n q, mod = divmod(n, (a+b))\n x = mod if mod < n else x = n\n print(q*a+x)\n\nif __name__ == "__main__":\n main()\n', 'def main():\n n, a, b = map(int, input().split())\n q, mod = divmod(n, (a+b))\n x = mod if mod < a else a\n print(q*a+x)\n\nif __name__ == "__main__":\n main()']
['Runtime Error', 'Accepted']
['s219477418', 's857271082']
[9040.0, 9084.0]
[30.0, 29.0]
[172, 167]
p02754
u175590965
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['n,a,b = map(int,input().split())\nc = n//(a+b)\nd = (n%(a+b))\nif a ==0:\n print(0)\nelif n%(a+b)==0:\n print(c*a)\nelif n%(a+b)!== 0 and d <=a :\n print((c*a)+d)\nelse:\n print((c*a)+a)\n', 'n,a,b = map(int,input().split())\nc = n//(a+b)\nd = n%(a+b)\nif b ==0:\n print(0)\nelif n%(a+b)==0:\n print(c*b)\nelse:\n print((c*b)+(d-a))', 'n,a,b = map(int,input().split())\nc = n//(a+b)\nif n%(a+b) >= a:\n print((c*a)+a)\nelse:\n print((c*a)+n%(a+b))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s180316278', 's440873962', 's805495692']
[2940.0, 3060.0, 9084.0]
[17.0, 18.0, 31.0]
[189, 141, 112]
p02754
u178304274
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()))\nkurikaeshi = n // (a + b)\namari = n - (kurikaeshi * (a+b))\nball_list = []\nans = 0\nblue = 'b' * a\nred = 'r' * b\nif(amari - len(blue) < 0):\n ans = 0\nif(amari - len(blue) == 0):\n ans = len(blue)\nelse:\n ans = len(blue) - amari\nprint(ans)", "n,a,b = list(map(int,input().split()))\nkurikaeshi = n // (a + b)\nans = kurikaeshi * a\namari = n - (kurikaeshi * (a+b))\nball_list = []\nans = 0\nblue = 'b' * a\nred = 'r' * b\nfor i in range(1,kurikaeshi+2):\n ball_list.append(blue)\n ball_list.append(red)\nfor l in range(0,a+1):\n if(list(ball_list)[amari] == 'b'):\n ans += 1\nprint(ans)", 'n,a,b = list(map(int,input().split()))\nif(a != 0):\n kurikaeshi = n // (a + b)\n mod = n % (a + b)\n ans = a*kurikaeshi\n if(mod - a > 0):\n ans += mod\nif(a == 0):\n ans = 0\nprint(ans)', "n,a,b = list(map(int,input().split()))\nkurikaeshi = n // (a + b)\namari = n - (kurikaeshi * (a+b))\nball_list = []\nans = 0\nblue = 'b' * a\nred = 'r' * b\nif(amari - len(blue) < 0):\n ans = 0\nelse:\n ans = len(blue) - amari\nprint(ans)", 'n,a,b = list(map(int,input().split()))\nif(a != 0):\n kurikaeshi = n // (a + b)\n mod = n % (a + b)\n ans = a*kurikaeshi\n if(mod - a > 0):\n ans += a\n else:\n ans += mod\nif(a == 0):\n ans = 0\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s426324148', 's488000645', 's647260401', 's798813456', 's698107814']
[3188.0, 184728.0, 3060.0, 3064.0, 3060.0]
[19.0, 2113.0, 17.0, 18.0, 17.0]
[281, 345, 200, 233, 227]
p02754
u181295070
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 = ('b'*a+'r'*b)*10**100\nprint(l[:n].count('b'))", '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']
['s074128789', 's604708748']
[3064.0, 3064.0]
[18.0, 18.0]
[82, 98]
p02754
u181701360
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['N, A, B = map(int, input().split())\nif A > (N % (A + B)):\n print(N // (A + B) + N % (A + B))\nelse:\n print(N // (A + B) + A)', 'N, A, B = map(int, input().split())\nif A > (N % (A + B)):\n print((N // (A + B)) * A + N % (A + B))\nelse:\n print((N // (A + B)) * A + A)']
['Wrong Answer', 'Accepted']
['s566185709', 's190861194']
[2940.0, 2940.0]
[17.0, 18.0]
[129, 141]
p02754
u183308534
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['if A == 0:\n print(0)\nelif B == 0:\n print(N)\nelse:\n ans = 0\n div = N //( A + B ) # A > 0\n ans = div * A\n ans += min( N % (A + B) , A)\n # mod = N % ( A + B )\n\n\n # if mod > A :\n # ans += A\n # else :\n # ans += mod\n \n print(ans)', 's = input()\n\nss = s.split(" ")\n\nN = int(ss[0])\nA = int(ss[1])\nB = int(ss[2])\n\nif A == 0:\n print(0)\nelif B == 0:\n print(N)\nelse:\n ans = 0\n div = N //( A + B ) # A > 0\n ans = div * A\n ans += min( N % (A + B) , A)\n # mod = N % ( A + B )\n\n\n # if mod > A :\n # ans += A\n # else :\n # ans += mod\n \n print(ans)']
['Runtime Error', 'Accepted']
['s215451968', 's147468110']
[3060.0, 3064.0]
[17.0, 17.0]
[240, 318]
p02754
u185005484
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(e) for e in input().split()]\nif N[1]==0:\n A=0\nelse:\n M=N[0]//(N[1]+N[2])\n if M==0:\n if N[0]>N[1]:\n A=N[1]\n else:\n A=N[0]\n else:\n A=M+N[0]%(N[1]+N[2])\nprint(A)\n\n\n', 'N=[int(e) for e in input().split()]\nA=N[0]//(N[1]+N[2])*N[1]\nM=N[0]%(N[1]+N[2])\nif N[1]>M:\n A+=M\nelse:\n A+=N[1]\nprint(A)\n\n']
['Wrong Answer', 'Accepted']
['s907692510', 's556376934']
[3060.0, 3060.0]
[18.0, 17.0]
[223, 128]
p02754
u185393907
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 = input().split(" ")\nres = int(a[0])\ndiv = int(a[1])+int(a[2])\nmult = math.floor(res/div)\nplus = res%div\nanswer = int(a[1])*mult + min([plus,int(a[1])])\nanswer', 'import math\na = input().split(" ")\nres = int(a[0])\ndiv = int(a[1])+int(a[2])\nmult = math.floor(res/div)\nplus = res%div\nanswer = int(a[1])*mult + min([plus,int(a[1])])\nprint(answer)']
['Wrong Answer', 'Accepted']
['s009266411', 's631365018']
[3060.0, 3064.0]
[17.0, 20.0]
[173, 180]
p02754
u187058053
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)\nif rem>=a:\n print(ans+a)\nelse \n print(ans + rem)', 'n, a, b = map(int, input().split())\n\nans = n//(a+b)*a\nans += min(a, n%(a+b))\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s351383490', 's843962618']
[2940.0, 2940.0]
[17.0, 19.0]
[121, 88]
p02754
u192042624
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 module\nimport sys\nimport math\nimport numpy as np\n\nN , A , B = map(int,input().split())\n\nx = int(N / (A+B)) \n\nif N - x*(A+B) > A:\n print(x*A+ A)\nelse:\n print(x*A + N)\n\n', '# import module\nimport sys\nimport math\nimport numpy as np\n\nN , A , B = map(int,input().split())\n\nx = int(N / (A+B)) \ny = N % (A+B)\n\nif y > A:\n print(x*A+ A)\nelse\n print(x*A + y )\n\n', '# import module\nimport sys\nimport math\nimport numpy as np\n\nN , A , B = map(int,input().split())\n\nx = N / (A+B) \n\nif N - x*(A+B) > A:\n print(x*A+ A)\nelse:\n print(x*A + N) ', '# import module\nimport sys\nimport math\nimport numpy as np\n\nN , A , B = map(int,input().split())\n\nx = int(N / (A+B)) \ny = N % (A+B)\n\nif y > A:\n print(x*A+ A)\nelse:\n print(x*A + y )\n\n']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s389340967', 's468613345', 's767318389', 's678037989']
[12424.0, 2940.0, 12424.0, 12504.0]
[152.0, 17.0, 150.0, 153.0]
[182, 186, 176, 187]
p02754
u193927973
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))*B+N%(A+B)-A\nprint(ans)', 'N, A, B=map(int, input().split())\nans=(N//(A+B))*A+min(A, N%(A+B))\nprint(ans)']
['Wrong Answer', 'Accepted']
['s599084009', 's830306038']
[3316.0, 2940.0]
[23.0, 19.0]
[71, 77]
p02754
u194637581
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?
['Me, a, b = map(int, input().split())\nperiod = a+b\ntimes = Me//period\nk = Me%period\nn = a if k >a else k\nprint(times*a + Me)', 'n, 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']
['s556530892', 's944998530']
[2940.0, 2940.0]
[18.0, 17.0]
[124, 120]
p02754
u195355592
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['N, A, B = list(map(int,input().split()))\n\ntmp = 0\nsuc = 0\nnum = 0\n\nfor i in range(1000):\n tmp += A\n if tmp > N:\n num = i + 1\n break\n else:\n suc = "B"\n tmp += B\n if tmp > N:\n num = i + 1\n break\n else:\n suc = "R"\n\nif suc == "R":\n print(num * A + (N - (A + B) * num))\nif suc == "B":\n print(num * A)\n', 'N, A, B = list(map(int,input().split()))\n\ntmp = 0\nsuc = 0\nnum = 0\n\nfor i in range(1000):\n tmp += A\n if tmp > N:\n num = i + 1\n break\n else:\n suc = "B"\n tmp += B\n if tmp > N:\n num = i + 1\n break\n else:\n suc = "R"\n\nprint(suc,num)\n\nif suc == "R":\n print(num * A + (N - (A + B) * num))\nif suc == "B":\n print(num * A)\n', '# coding cell (SUBMIT ONLY THIS CELL)\n\nN, A, B = list(map(int,input().split()))\n\nX = N // (A + B) * A\nY = N % (A + B)\nif Y <= A:\n Z = Y\nelse:\n Z = A\n\nprint(X + Z)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s731893230', 's917305869', 's725138618']
[3064.0, 3064.0, 2940.0]
[20.0, 17.0, 18.0]
[362, 378, 168]
p02754
u197610362
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\n\nn, a, b = input().split()\n\nd = n // (a + b)\nm = n % (a + b)\n\nblue = a * k\nif m >= a:\n blue = blue + a\nelse:\n blue = blue + m\n \nprint(blue)\n', 'n, a, b = input().split()\n \nd = n // (a + b)\nm = n % (a + b)\n \nblue = a * d\nif m >= a:\n blue = blue + a\nelse:\n blue = blue + m\n \nprint(blue)', 'n, a, b = input().split()\nn = int(n)\na = int(a)\nb = int(b)\n \nd = n // (a + b)\nm = n % (a + b)\n \nblue = a * d\nif m >= a:\n blue = blue + a\nelse:\n blue = blue + m\n \nprint(blue)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s068578534', 's333733396', 's212121623']
[2940.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[155, 143, 176]
p02754
u198073053
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(n/(a+b))*a + n%(a+b) - (n%(a+b)%a))', 'n,a,b = map(int,input().split())\nuni = int(n/(a+b))\nif n > (a+b)*uni + a:\n print(a*uni + a)\nelse:\n print(a*uni + n%(a+b))']
['Runtime Error', 'Accepted']
['s110001082', 's803430615']
[3064.0, 3060.0]
[18.0, 19.0]
[78, 123]
p02754
u198930868
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 = []\nblue = ["b"]*a\nred = ["r"]*b\n\nwhile len(ans) < (n-min(a,b)):\n\tans.extend(blue)\n\tans.extend(red)\n\nprint(ans[:n].count("b"))', 'n,a,b = map(int,input().split())\nans = n // (a + b)*a\n\nrem = n % (a + b)\n\nans += min(rem,a)\nprint(ans)']
['Runtime Error', 'Accepted']
['s545976981', 's087090368']
[35096.0, 2940.0]
[2316.0, 17.0]
[164, 102]
p02754
u200527996
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['N,A,B = map(int, input().split())\nans = 0\ncount = 0\nfor _ in range(10**100):\n ans += A\n count += A+B\n print(ans,count)\n if count > N:\n ans += min(0,B-(count-N))\n print(ans)\n exit()', 'N,A,B = map(int, input().split())\nans = ""\nwhile len(ans) <= N:\n ans += "b"*A + "r"*B\nprint(ans)\nprint(ans[:N].count("b"))', 'N,A,B = map(int, input().split())\ntemp = N//(A+B)\nN-=(A+B)*temp\nans = temp * A\nans += min(N,A)\nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s601164621', 's617751360', 's790832175']
[32824.0, 1927444.0, 2940.0]
[2107.0, 2239.0, 18.0]
[193, 125, 105]
p02754
u201387466
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['N,A,B = map(int,input().split())\nn = N // (A+B)\nans = A * n\nm = N % n\nif m > A:\n print(ans+A)\nelse:\n print(ans+m)\n', 'N,A,B = map(int,input().split())\nif A ==0 :\n print(0)\nelif B==0:\n print(N)\nelse:\n m = N % (A+B)\n n = N // (A+B)\n ans = A * n\n if m > A:\n print(ans+A)n\n else:\n print(ans+m)\n', 'N,A,B = map(int,input().split())\nif A+B != 0:\n n = N // (A+B)\n ans = A * n\n m = N % n\n if m > A:\n print(ans+A)\n else:\n print(ans+m)\nelse:\n print(0)\n', 'N,A,B = map(int,input().split())\nif A ==0 :\n print(0)\nelif B==0:\n print(N)\nelse:\n n = N // (A+B)\n ans = A * n\n m = N % n\n if m > A:\n print(ans+A)\n else:\n print(ans+m)', 'N,A,B = map(int,input().split())\nif A ==0 :\n print(0)\nelif B==0:\n print(N)\nelse:\n m = N % (A+B)\n n = N // (A+B)\n ans = A * n\n if m > A:\n print(ans+A)\n else:\n print(ans+m)\n\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s089294933', 's500431688', 's501372161', 's788693844', 's451539799']
[2940.0, 2940.0, 2940.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0, 18.0, 17.0]
[120, 207, 180, 201, 207]
p02754
u203383537
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?
['\nif a==0:\n print(0)\nelif n>a:\n print(n-b)\nelif n<=a:\n print(n)\n', 'n,a,b = map(int,input().split())\n\nans = n//(a + b)*a\nans += min(n%(a + b),a)\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s700726520', 's323521514']
[2940.0, 9044.0]
[19.0, 28.0]
[72, 88]
p02754
u205936263
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['(N, A, B) = list(map(int, input().split()))\n\ncnt = int(N / (A + B))\nrest = N % (A + B) \nif A == 0:\n print(0)\nelif rest > A:\n print(cnt*A + rest)\nelse:\n print(cnt*A + A)\n', '(N, A, B) = list(map(int, input().split()))\n\ncnt = int(N / (A + B))\nrest = N % (A + B) \nif A == 0:\n print(0)\nelif rest > A:\n print(cnt*A + A)\nelse:\n print(cnt*A + rest)\n']
['Wrong Answer', 'Accepted']
['s516058494', 's681731868']
[2940.0, 2940.0]
[17.0, 17.0]
[178, 178]
p02754
u206133536
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\nfulls = n // (a+b)\nlefts = n % (a+b)\n\nprint(fulls*a + min(left, a))', 'n, a, b = map(int, input().split())\n \nfulls = n // (a+b)\nlefts = n % (a+b)\n \nprint(fulls*a + min(lefts, a))']
['Runtime Error', 'Accepted']
['s197020973', 's441646690']
[2940.0, 2940.0]
[18.0, 18.0]
[104, 107]
p02754
u208464243
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 = map(int,input().split())\n\nans = N //(A+B) *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)']
['Runtime Error', 'Accepted']
['s571689835', 's142869040']
[2940.0, 2940.0]
[18.0, 17.0]
[103, 99]
p02754
u209275335
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 = a*(n//(a+b)) + min(N%(a+b),a)\nprint(ans)', 'n,a,b = map(int,input().split())\nans = a*(n//(a+b)) + min(n%(a+b),a)\nprint(ans)']
['Runtime Error', 'Accepted']
['s512628896', 's504033414']
[3316.0, 2940.0]
[20.0, 17.0]
[79, 79]
p02754
u213314609
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 = int(input())\nB = int (input())\n\nif A == 0:\n print 0 \nelse: \n print( N - 2 )', 'n, 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)']
['Runtime Error', 'Accepted']
['s719961644', 's934911033']
[2940.0, 2940.0]
[17.0, 17.0]
[103, 120]
p02754
u215286521
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 = list(map(int, input().split()))\nn = nums[0]\na = nums[1]\nb = nums[2]\n\nif a == 0:\n print(0)\nelif b == 0:\n print(n)\nelse:\n print(n / (a+b) * a)', 'nums = list(map(int, input().split()))\nn = nums[0]\na = nums[1]\nb = nums[2]\n\nif a == 0:\n print(0)\nelif b == 0:\n print(a)\nelse:\n print(n // (a+b) * a)', 'nums = list(map(int, input().split()))\nn = nums[0]\na = nums[1]\nb = nums[2]\n\nif a == 0:\n print(0)\nelif b == 0:\n print(n)\nelse:\n print(n // (a+b) * a)', 'nums = list(map(int, input().split()))\nn = nums[0]\na = nums[1]\nb = nums[2]\n\nif a == 0:\n print(0)\nelif b == 0:\n print(a)\nelse:\n print(int(n / (a+b) * a))', 'nums = list(map(int, input().split()))\nn = nums[0]\na = nums[1]\nb = nums[2]\n\nif a == 0:\n print(0)\nelif b == 0:\n print(n)\nelse:\n c = n // (a+b) * a\n mod = n % (a+b)\n if mod > a :\n mod = a\n print(c + mod)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s323986434', 's557463833', 's621558410', 's755210796', 's200995691']
[3060.0, 3064.0, 3060.0, 3068.0, 3064.0]
[17.0, 18.0, 18.0, 18.0, 18.0]
[155, 156, 156, 160, 221]
p02754
u224119985
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()\ni=((A+B)*(10**100)//N)*A\nif ((A+B)*(10**100))%N>A:\n i=i+A\nelse:\n i=i+((A+B)*(10**100)%N)\nprint(i)\n', 'N,A,B=map(int,input().split())\ni=N//((A+B)*(10**100))*A\nif N%((A+B)*(10**100))>A:\n i=i+A\nelse:\n i=i+(N%(A+B)*(10**100))\nprint(i)\n', 'N,A,B=map(int,input().split())\ni=(N//(A+B))*A\nif N%(A+B)>A:\n i=i+A\nelse:\n i=i+(N%(A+B))\nprint(i)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s917813870', 's964668118', 's144255408']
[2940.0, 2940.0, 2940.0]
[18.0, 21.0, 18.0]
[134, 135, 102]
p02754
u224554402
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,c= input().split()\nx,y,z=(int(a),int(b),int(c))\nnum_one_gr = y + z\nnum_gr = math.floor(x/num_one_gr)\namari = x - num_one_gr*num_gr\nif amari <= y:\n total = y * num_gr + amari\nelse:\n total = y*(num_gr + 1)', 'import math\na,b,c= input().split()\nx,y,z=(int(a),int(b),int(c))\nnum_one_gr = y + z\nnum_gr = math.floor(x/num_one_gr)\namari = x - num_one_gr*num_gr\nif amari <= y:\n total = y * num_gr + amari\nelse:\n total = y*(num_gr + 1)\nprint(total)']
['Wrong Answer', 'Accepted']
['s106898101', 's031268587']
[3064.0, 3060.0]
[18.0, 18.0]
[225, 238]
p02754
u225845681
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['N,A,B = map(int,input().split())\nn = int(N/(A+B))\namari = (A+B)%N\nif amari >= A:\n Ans = (n*A) + A\nelse:\n Ans = (n*A) + amari\nprint(Ans)', 'N,A,B = map(int,input().split())\nn = int(N/(A+B))\namari = N%(A+B)\nif amari >= A:\n Ans = (n*A) + A\nelse:\n Ans = (n*A) + amari\nprint(Ans)']
['Wrong Answer', 'Accepted']
['s344811916', 's484627940']
[2940.0, 2940.0]
[17.0, 19.0]
[137, 137]
p02754
u227082700
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*(n//(a+b))\nans+=min(b,n%(a+b))\nprint(ans)', 'n,a,b=map(int,input().split())\nm=a+b\nans=(n//m)*a\nn%=m\nans+=min(a,n)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s354598510', 's982889378']
[2940.0, 2940.0]
[19.0, 17.0]
[78, 79]
p02754
u228303592
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['n, a, b = map(int,input().split())\np = n // (a+b)\nans = a*b + min(a,(n%(a + b)))\nprint(ans)', 'n, a, b = map(int,input().split())\np = n // (a+b)\nans = a*p + min(a,(n%(a + b)))\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s997142481', 's227937175']
[9104.0, 9112.0]
[27.0, 30.0]
[91, 92]
p02754
u234733300
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())\nif(b == 0 and r == 0):\n print(0)\nelif (b ==0):\n print(0)\nelse :\n sets = N/(b+r)\n surplus = N%(b+r)\n Number_of_Blue = sets * b + b\n print(Number_of_Blue)', 'N, b ,r = map(int,input().split())\nprint(b)', 'N,b,r = input().split()\nif(b==0 and r == 0):\n print(0)\nelse :\n set = N/(b+r)\n surplus = N%(b+r)\n Numbe_of_Blue = set * b + b\n print(Numbe_of_Blue)\n', 'N,b,r = input().split()\nif(b==0 and r == 0):\n print(0)\nelse :\n sets = N/(b+r)\n surplus = N%(b+r)\n Numbe_of_Blue = sets * b + b\n print(Numbe_of_Blue', 'N,b,r = map(int,input().split())\nif(b == 0 and r == 0):\n print(0)\nelse :\n sets = int(N/(b+r))\n surplus = int(N%(b+r))\n Number_of_Blue = sets * b + b\n print(Number_of_Blue)', 'N,b,r = map(int,input().split())\nif(b==0 and r == 0):\n print(0)\nelse :\n sets = N/(b+r)\n surplus = N%(b+r)\n Numbe_of_Blue = sets * b + b\n print(Numbe_of_Blue)', 'N,b,r = map(int,input().split())\nif(b == 0 and r == 0):\n print(0)\nelif (b ==0):\n print(0)\nelse :\n sets = N//(b+r)\n surplus = N%(b+r)\n if(surplus - b > 0):\n residue = b\n elif(surplus - b < 0):\n residue = surplus \n Number_of_Blue = sets * b + residue\n print(Number_of_Blue)']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s005533752', 's388702977', 's536999854', 's589384513', 's804791464', 's829788112', 's329264626']
[3060.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 3064.0]
[17.0, 17.0, 17.0, 17.0, 18.0, 17.0, 18.0]
[191, 43, 152, 152, 176, 162, 286]
p02754
u236666830
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()) \n\nif a==0:\n print(0)\nelse:\n s= n//(a+b)\n sn = n%(a+b)\n if sn > a:\n print (s*a+a)\n else:\n print (s*a+a-sn)\n\n', '\nn, a, b = map(int, input().split()) \n\nif a==0:\n print(0)\nelse:\n s= n//(a+b)\n sn = n%(a+b)\n if sn > a:\n print (s*a+a)\n else:\n print (s*a+sn)\n\n']
['Wrong Answer', 'Accepted']
['s201216253', 's731236175']
[2940.0, 2940.0]
[18.0, 17.0]
[155, 153]
p02754
u236823931
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
["if __name__ == '__main__':\n (n, a, b) = map(int, input().split())\n if a == 0: print(0)\n elif n <= a+b:\n print(a)\n else:\n set_count = int(n/(a+b))*a+1\n print(set_count)", "if __name__ == '__main__':\n (n, a, b) = map(int, input().split())\n a = n//(a+b)\n m = min(n%(a+b), a)\n print(a+m)", "if __name__ == '__main__':\n (n, a, b) = tuple(map(int, input().split()))\n ans = n // (a + b) * a\n ans += min(n % (a + b), a)\n print(ans)"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s003492431', 's270594039', 's096793848']
[3064.0, 2940.0, 3060.0]
[18.0, 17.0, 17.0]
[192, 124, 148]
p02754
u245299791
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['N,A,B=map(int,input().split())\nans=0\nif A>=N:\n ans=N\nelif A<N<=A+B:\n ans=A\nelif N>A+B:\n num=int(N/(A+B))\n ans=num*A+N-(A+B)*num\n if n-(A+B)*num>=A:\n ans=(num+1)*A\nprint(ans)\n\n', 'N,A,B=map(int,input().split())\nnum=N//(A+B)\nrest=min(N%(A+B),A)\nans=num*A+rest\nprint(ans)']
['Runtime Error', 'Accepted']
['s013871074', 's455475762']
[3060.0, 2940.0]
[17.0, 17.0]
[183, 89]
p02754
u246372582
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())\nana=N//(A+B)*A\nrem=N%(A+B)\nana=ana+max(rem,A)\nprint(ana)', 'N,A,B=map(int,input().split())\nana=N//(A+B)*A\nrem=N%(A+B)\nana=ana+rem.count(A)\nprint(ana)', 'N,A,B=map(int,input().split())\nana=N//(A+B)*A\nrem=N%(A+B)\nana=ana+min(rem,A)\nprint(ana)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s356149059', 's926078309', 's675357022']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[87, 89, 87]
p02754
u247680229
2,000
1,048,576
Takahashi has many red balls and blue balls. Now, he will place them in a row. Initially, there is no ball placed. Takahashi, who is very patient, will do the following operation 10^{100} times: * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row. How many blue balls will be there among the first N balls in the row of balls made this way?
['N, A, B=list(map(int, input().split()))\n\nprint(A)', 'a=0\nfor i in range(10^100):\n N, A, B=list(map(int, input().split()))\n if A+B==N:\n a=a+A\n else:\n a=a+A+N-(A+B)\n \n \nprint(a)', 'N,A,B=list(map(int, input().split()))\n\nif N%(A+B)==0:\n print(N//(A+B)*A)\n\nelse:\n rem=min(N%(A+B),A)\n print(N//(A+B)*A+rem)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s352101019', 's605738628', 's588862358']
[2940.0, 3064.0, 3060.0]
[18.0, 17.0, 17.0]
[49, 135, 131]
p02754
u250554058
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\n\ndef main():\n n,a,b = (int(x) for x in input().split())\n\n num_x = 0\n num_a = (math.floor(n/(a + b)))\n num_b = int(n % (a + b))\n \n if(num_a == 0):\n num_x = a\n elif(n < (a + b)):\n if(num_b >= a):\n num_x = a\n else:\n num_x = num_b\n\n print(int(num_a * a + num_x))\n \nif __name__ == '__main__':\n main() \n", "import math\n\ndef main():\n n,a,b = (int(x) for x in input().split())\n\n num_x = 0\n num_a = (math.floor(n/(a + b)))\n num_b = int(n % (a + b))\n \n if(num_a == 0):\n nun_x = a\n elif(n < (a + b)):\n if(num_b >= a):\n num_x = a\n else:\n num_x = num_b\n\n print(int(num_a * a + num_x))\n \nif __name__ == '__main__':\n main() \n", "import math\n\ndef main():\n n,a,b = (int(x) for x in input().split())\n\n num_a = (math.floor(n/(a + b)))\n num_b = int(n % (a + b))\n\n print(int(num_a * a + min(a, num_b)))\n \nif __name__ == '__main__':\n main() \n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s074033624', 's398798439', 's295228544']
[3064.0, 3064.0, 3060.0]
[18.0, 17.0, 18.0]
[339, 339, 213]
p02754
u253799217
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(' ')))\nS = A + B\ncount = N // S if S != 0 else 0\nmod = N % S if S != 0 and count % 2 == 0 else 0\nprint(A*count + mod)\n", "import math\nN, A, B = list(map(int, input().split(' ')))\nS = A + B\ncount = N // S if S != 0 else 0\nmod = min(N % S, A) if S != 0 else 0\nprint(A*count + mod)\n"]
['Wrong Answer', 'Accepted']
['s883785318', 's631958687']
[2940.0, 2940.0]
[17.0, 18.0]
[168, 157]
p02754
u255821449
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\nN, A, B = map(int, input().split())\n\nq, mod = divmod(N, A + B)\n\nprint((A * q) + min(mod, A)))\n', '# -*- coding: utf-8 -*-\n\nN, A, B = map(int, input().split())\n\nq, mod = divmod(N, A + B)\n\nprint((A * q) + min(mod, A))\n']
['Runtime Error', 'Accepted']
['s473061556', 's383586431']
[3064.0, 2940.0]
[17.0, 18.0]
[119, 118]
p02754
u256314031
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 = tuple(input().split())\nprint((N // (A + B)) * A + N % (A + B))', 'inp = input().split()\ninp = [int(i) for i in inp]\nN, A, B = inp\nans = (N//(A+B))*A\nrem = N%(A+B)\nans += min(rem, A)\nprint(ans)']
['Runtime Error', 'Accepted']
['s406983104', 's199350987']
[2940.0, 3060.0]
[17.0, 17.0]
[70, 126]