CodeEff/ECCO huggingface dataset:
# Original solution
N, A, B = list(map(int,input().split()))
l = []

while (len(l) < N):
  tmp  = ['b' for i in range(A) if (len(l) + i) < N]
  tmp2 = ['r' for i in range(B) if (len(l) + len(tmp) + i) < N]
  l += (tmp + tmp2)

print((l.count('b')))


# Optimized solution

N, A, B = list(map(int, input().split()))
out = N // (A + B) * A
rem = min(N % (A + B), A)
print((out + rem))
# Original solution
N, A, B = list(map(int,input().split()))

list = []
for _ in range(N):
    [list.append('b') for i in range(A)]
    [list.append('c') for j in range(B)]

a = list[:N:]
print((a.count("b")))


# Optimized solution
N, A, B = list(map(int,input().split()))
ans = A*(N//(A+B)) + min(N%(A+B),A)
print(ans)
# Original solution
import sys
n,a,b=list(map(int,input().split()))
count=0
if a==0:
  print('0')
  sys.exit()
else:
  while n>=a:
    n=n-a
    count+=1
    if n>=b:
      n=n-b
    elif n<b:
      n=0
ball=a*count+n
print(ball)

# Optimized solution
n,a,b=list(map(int,input().split()))

kosuu=n//(a+b)
amari=n%(a+b)

if a>amari:
  print((a*kosuu+amari))
else:
  print((a*kosuu+a))
# Original solution
input_lines=list(map(int,input().split()))
balls=[]
count=0
for i in range(10**100):
    for j in range(input_lines[1]):
        balls.append('b')
    for j in range(input_lines[2]):
        balls.append('r')
    if len(balls)>input_lines[0]:
        break
for i in range(input_lines[0]):
    if balls[i]=='b':
        count+=1
print(count)

# Optimized solution
n,a,b=list(map(int,input().split()))
answer=n//(a+b)*a+min(n%(a+b),a)
print(answer)
# Original solution
N, A, B = list(map(int, input().split(" ")))


balls = []
isFinish = True
count = 0
while isFinish:
    if len(balls) >= N:
        isFinish = False
    
    for i in range(A):

        if len(balls) >= N:
            isFinish = False
            break
        balls.append('b')
        count += 1
        

    for i in range(B):
        if len(balls) >= N:
            isFinish = False
            break
        balls.append('r')
        

print(count)

# Optimized solution
def main():
    N, A, B = list(map(int, input().split(" ")))
    if (A + B) == 0:
        print((0))
        return
    amari = N % (A+B)
    kaisuu = N // (A+B)
    print((kaisuu*A+min(amari, A)))
main()
# Original solution
N,A,B = list(map(int,input().split()))
ans = list()
a = "a"
b = "b"
while N > 0:
    for _ in range(A):
        ans.append(a)
        N = N - 1
        if N == 0:
            print((ans.count(a)))
            exit()
    for _ in range(B):
        ans.append(b)
        N = N - 1
        if N == 0:
            print((ans.count(a)))
            exit()

# Optimized solution
N,A,B = list(map(int,input().split()))
if A == 0:
    print(A)
    exit()
n = N // (A + B)
nn = N % (A + B)
if n != 0 and nn <= A:
    print((int(A*n + nn)))
elif n != 0 and nn > A:
    print((int(A*(n+1))))
elif n == 0 and N >= A:
    print(A)
elif n == 0 and N < A:
    print(N)
# Original solution
N, b, r = list(map(int, input().split()))

s = 0
t = 0
for i in range(10**100):
    t = t+b+r
    s += 1
    if N<=t:
        if (t-N)<r:
            print((s*b))
            exit()
        else:
            print(((s-1)*b+N-t+b+r))
            exit()

# Optimized solution
N, b, r = list(map(int, input().split()))

t = N//(b+r)
s = N%(b+r)

if s>=b:
    print(((t+1)*b))
else:
    print((t*b + s))
# Original solution
N, A, B = list(map(int, input().split()))

List=[]

while len(List) < N:
    for i in range(A):
        List.append("b")
    for i in range(B):
        List.append("r")

for i in range (len(List)-N):
    del List[N]

print((List.count("b")))


# Optimized solution
N, A, B = list(map(int, input().split()))

brset = A + B
inside = N // (A+B)
count = inside*A

if inside*brset + A <= N:
    count += A
else:
    count += N - (inside*brset)

print(count)
# Original solution
n,a,b=list(map(int,input().split()))
x,y=0,0
i=0
while(n>0):
    if(i%2==0):
        x+=min(n,a)
        n-=min(n,a)
    else:
        y+=min(b,n)
        n-=min(n,b)
    i+=1
print(x)


# Optimized solution
n,a,b=list(map(int,input().split()))
x=n//(a+b)
y=n%(a+b)
if(y>=a):
    print((x*a+a))
else:
    print((a*x+y))
# Original solution
Nf,Af,Bf = (input().split(' '))
N = int(Nf)
A = int(Af)
B = int(Bf)
a = N % (A + B)
b = N // (A + B)

if a < A + 1:
  print((A*b+a))
else:
  print((A*b+A))

# Optimized solution
N,A,B = list(map(int,input().split()))
a = N//(A+B)
b = N%(A+B)
if b >= A:
    b = A
print((a*A+b))
# Original solution
n, a, b = list(map(int, input().split()))

count = 0
while n > 0:
    for i in range(a):
        count += 1
        n -= 1
        if n == 0:
            break
    if n != 0:
        for j in range(b):
            n -= 1
            if n == 0:
                break
print(count)

# Optimized solution
n, a, b = list(map(int, input().split()))

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

if y <= a:
    print((x*a + y))
else:
    print((x*a + a))
# Original solution
a,b,c = list(map(int,input().split()))
d = 0
l = a // (b+c)
k = a % (b+c)
if b == 0:
    print('0')
    
elif b + c >= a:
    if b < a:
        print(b)
    elif b > a:
        print(a)
    
elif b + c < a:
    if a % (b + c) == 0:
        print((int(l)))
    elif a % (b + c) != 0:
        if b > k:
            print((int(l*b + k)))
        elif b < k:
            print((int(l*b + b)))

# Optimized solution
N, A, B = list(map(int, input().split()))
div = N//(A+B)
mod = N % (A+B)
print((div*A+min(mod, A)))
# Original solution
N,A,B = list(map(int,input().split()))
s=0
if(N%(A+B)>A):
    s+=A
else:
    s+=N%(A+B)
s+=N//(A+B)*A
print(s)

# Optimized solution
N,A,B = list(map(int,input().split()))
print(((N//(A+B))*A + min(N%(A+B),A)))
# Original solution
n,a,b = list(map(int,input().split()))
su = 0
blue = 0
nn = 5**100

for i in range(nn):
    for x in range(0,a):
        if su < n:
            su += 1
            blue += 1
    for y in range(0,b):
        if su >= n:
            break
        su += 1
    else:
        continue
    break

print((str(blue)))

# Optimized solution
n,a,b = list(map(int,input().split()))
su = 0
blue = 0

mo = n%(a+b)
mu = int(n/(a+b))

if mo > a:
    ma = mo-a
    blue = n-ma-b*mu
elif mo <= a:
    blue = n- b*mu

print((str(blue)))
# Original solution
n, a, b = list(map(int, input().split()))

ans = 0
while n > a+b:
    ans += a
    n -= a+b

ans += min(n, a)
print(ans)

# Optimized solution
n, a, b = list(map(int, input().split()))

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

print(ans)
# Original solution
n,a,b = list(map(int,input().split()))
rest = n%(a+b)
n -= rest
ans = n//(a+b)*a
if rest >= a:
  ans += a
elif rest < a:
  ans += rest

print(ans)

# Optimized solution
n,a,b = list(map(int,input().split()))
rest = n%(a+b)

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

print(ans)
# Original solution
N, A, B = list(map(int, input().split()))

current_n = N
b_cnt = 0
flag = True
while current_n != 0:
    if flag:
        if current_n - A > 0:
            current_n = current_n - A
            b_cnt += A
        else:
            b_cnt += current_n
            current_n = 0
        flag = False
    else:
        if current_n - B > 0:
            current_n = current_n - B
        else:
            current_n = 0
        flag = True

print(b_cnt)


# Optimized solution
N, A, B = list(map(int, input().split()))

q, r = divmod(N, A+B)

if r >= A:
    print((q*A+A))
else:
    print((q*A+r))
# Original solution
n, a, b = list(map(int, input().split()))
if a == 0:
    print((0))
else:
    syou = n//(a+b)
    amari = n%(a+b)

    if amari < a:
        print((syou*a+amari))
    else:
        print(((syou+1)*a))

# Optimized solution
n, a, b = list(map(int, input().split()))
print((n//(a+b) * a + min(n%(a+b), a)))
# Original solution
n,a,b = list(map(int, input().split()))
x = n // (a+b)
amari = n % (a+b)
if amari <= a:
    print((x*a+amari))
else:
    print((x*a+a))

# Optimized solution
n,a,b = list(map(int, input().split()))
s = n//(a+b)
rest = n%(a+b)
print((s*a+min(a,rest)))
# Original solution
# 入力の取得
i = list(map(int, input().split()))
kazoeru = i[0]
ao = i[1]
aka= i[2]
kaisuu = i[0]/(i[1]+i[2])

number = 0
list = []

# リスト作成
while number <= kaisuu:
    # 青いボールを追加
    ball = 0
    while ball < ao:
        list.append("ao")
        ball += 1

    # 赤いボールを追加
    ball = 0
    while ball < aka:
        list.append("aka")
        ball += 1
    #回数加算
    number += 1

# 青ボールを数える
number = 0
aonokazu = 0
while number < kazoeru:
    if list[number] == "ao":
        aonokazu += 1
    number += 1

print(aonokazu)

# Optimized solution
# 入力の取得
i = list(map(int, input().split()))
kazoeru = i[0]
ao = i[1]
aka= i[2]
kaisuu = i[0]/(i[1]+i[2])

answer = divmod(kazoeru, (i[1]+i[2]))

if ao == 0:
    print((0))
    exit()

#商の分を計算
aa = ao * answer[0]

#あまりの分を計算
if answer[1] == 0:
    print(aa)
    exit()

#あまり6で、青が6なら
# あまりが青より多いなら(あまり4、青2)
if answer[1] >= ao:
    aa += ao
#あまりが青より少ないなら(あまり1、青3)
else:
    aa += answer[1]
print(aa)
# Original solution
N,A,B = list(map(int,input().split()))
ans = 0
for i in range(10**100):
    if N > A+B:
        N -= (A+B)
        ans += A
    else:
        break
if N >= A:
    ans += A
    print(ans)
else :
    ans += N
    print(ans)

# Optimized solution
N, A, B = list(map(int, input().split()))
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)
# Original solution
N, A, B = [int(v) for v in input().strip().split(" ")]

loop, m = divmod(N, A + B)
cnt_b = 0
cnt_all = 0
for _ in range(loop):
    cnt_b += A
if m < A:
    cnt_b += m
else:
    cnt_b += A
print(cnt_b)

# Optimized solution
N, A, B = [int(v) for v in input().strip().split(" ")]

loop, m = divmod(N, A + B)
print((loop * A + (m if m < A else A)))
# Original solution
n,a,b = list(map(int, input().split()))

shou = n // (a+b)
amari = n % (a+b)

if amari >= a:
    print((shou * a + a))

else: print((shou * a + amari))

# Optimized solution
n,a,b = list(map(int, input().split()))

shou = n // (a+b)
amari = n % (a+b)

ans = shou*a+a if amari >= a else shou*a+amari

print(ans)
# Original solution
n, a, b = [int(i) for i in input().split()]
s = []
for _ in range(n//(a+b)+1):
    s += [1 for _ in range(a)] + [0 for _ in range(b)]
print((sum(s[:n])))


# Optimized solution

n, a, b = [int(i) for i in input().split()]
sy = n // (a+b)
am = n % (a+b)
print((sy*a + min(am, a)))
# Original solution
N, A, B = [int(y) for y in input().split(' ')]
count = 0
while N >= A:
  count += 1
  N -= A+B
if A == 0:
  print((0))
elif N > 0:
  print((count*A + N))
else:
  print((count*A))

# Optimized solution
N, A, B = [int(y) for y in input().split(' ')]
count = N // (A+B)
residue = N % (A+B)
 
if A == 0:
  print((0))
elif residue > A:
  print((count*A + A))
elif residue > 0:
  print((count*A + residue))
else:
  print((count*A))
# Original solution
def main():
    N, A, B = list(map(int, input().split()))

    ret = 0
    rep, rest = divmod(N, A + B)
    ret += rep * A
    ret += min(A, rest)

    print(ret)


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())


# Optimized solution
def main():
    N, A, B = list(map(int, input().split()))
    AB = A + B

    q, r = divmod(N, AB)
    print((A * q + min(r, A)))


if __name__ == '__main__':
    main()
# Original solution
N, A, B = list(map(int,input().split()))
ans = 0
x = 0
Ball = []
while x < N:
    x = x + A + B
    for i in range(A):
        Ball.append('b')
    for i in range(B):
        Ball.append('r')
Ball = Ball[0:N]
ans = Ball.count('b')
print(ans)

# Optimized solution
N, A, B = list(map(int,input().split()))
x = N // (A + B)
y = N % (A + B)
ans = x * A + min(y,A)
print(ans)
# Original solution
n, b, r = list(map(int,input().split()))
l = list()
k = 0
for i in range(0,n,b+r):
  for j in range(b):
    l.append('b')
  for j in range(r):
    l.append('r')
for j in range(b):
  l.append('b')
for j in range(r):
  l.append('r')
print((l[0:n].count('b')))

# Optimized solution
n, b, r = list(map(int,input().split()))
a = n//(b+r) * b
c = n%(b+r)
a += min(c,b)
print(a)
# Original solution
N,A,B = [int(x) for x in input().split()]
n = 0
blue = 0
if A == 0:
    print((0))
else:
    for i in range(10**7):
        n = n + A
        blue = blue + A
        if n >= N:
            blue = blue - (n-N)
            break
        else:
            n = n + B
            if n >= N:
                break
    print(blue)

# Optimized solution
N,A,B = list(map(int,input().split()))

a = N//(A+B)*A

if N%(A+B) <= A:
    print((a + N%(A+B)))
else:
    print((a + A))
# Original solution
n,b,r=list(map(int,input().split()))
alist=[]
count=0

while len(alist)<n:
  for i in range(b):
    alist.append('b')
  for i in range(r):
    alist.append('r')

del alist[n:]

for i in alist:
  if i=='b':
    count+=1

print(count)


# Optimized solution
n,b,r=list(map(int,input().split()))

ans=n//(b+r)*b
sur=n%(b+r)
ans+=min(sur,b)
print(ans)
# Original solution
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, A, B = lr()
time, remain = divmod(N, (A+B))
answer = A * time + min(A, remain)
print(answer)


# Optimized solution
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, A, B = lr()
time = N // (A+B)
remain = N - (A+B) * time
answer = A * time + min(A, remain)
print(answer)
# Original solution
n, a, b = list(map(int, input().split(' ')))
tmp = 0
count = 0
if a == 0:
    print((0))
elif n % (a+b) == 0:
    print((a*(n // (a+b))))
elif n % (a+b) == a:
    print((a*(n // (a+b)+1)))
else:
    while count < 10**100:
        n -= a
        tmp += a
        if n <= 0:
            print((tmp + n))
            break
        n -= b
        if n <= 0:
            print(tmp)
            break
    

# Optimized solution
n, a, b = list(map(int, input().split(' ')))
if a == 0:
    print((0))
elif n % (a+b) <= a:
    print((a*(n // (a+b))+ n % (a+b)))
else:
    print(( a*(n // (a+b))+a))
# Original solution
N, A, B = list(map(int, input().split()))

num = 0
blue = 0
red = 0
for i in range(10**18):
    if i % 2 == 0 and N >= num:
        num += A
        blue += 1
    elif i % 2 == 1 and N >= num:
        num += B
        red += 1

    else:
        break
# print(num)
# print(blue)
# print(red)

if blue > red:
    aa = N - A * blue - B * red
    ans_b = A * blue + aa
else:
    aa = N - A * blue - B * red
    ans = B * red + aa
    ans_b = N - ans

print(ans_b)

# Optimized solution
N, A, B = list(map(int, input().split()))

A_amari = A % 2
B_amari = B % 2

# print(A_amari)
# print(B_amari)

if A+B == 0:
    print((0))
    exit()
else:
    cnt = N // (A+B)
    amari = N % (A+B)

# print(cnt)
# print(amari)
if amari <= A:
    print((A*cnt+amari))
else:
    if amari <= B or amari > A:
        print((A*(cnt+1)))
# Original solution
n, a, b = list(map(int, input().split()))

array = []

for t in range(10 ** 18):
    if len(array) >= n:
        break
    for p in range(a):
        array.append('blue')
    for q in range(b):
        array.append('red')

f = n // (a+b)
g = n % (a+b)

if g <= a:
    print((f * a + g))
    
else:
    print((f * (a+1)))

# Optimized solution
n, a, b = list(map(int, input().split()))

f = n // (a+b)
g = n % (a+b)

if g <= a:
    print((a * f + g))
    
else:
    print((a * (f+1)))
# Original solution
import sys
input = sys.stdin.readline

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

AB = A + B

if AB == 0:
    print((0))
    sys.exit()

ans = A * (N // AB)
ans_mod = N % AB 

if ans_mod == 0:
    print(ans)
    sys.exit()

if ans_mod >= A:
    ans += A
elif ans_mod < A:
    ans += ans_mod

print(ans)

# Optimized solution
import sys
input = sys.stdin.readline

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

if a == 0:
    print((0))
    sys.exit()

if b == 0:
    print(n)
    sys.exit()

ab = a + b

n_ab = n // ab

ans = n_ab * a

remain = n - ab * n_ab

ans += min(a, remain)

print(ans)
# Original solution
a,b,c = list(map(int,input().split()))

s = b + c
counter = 1
ans = 0
while True:
  if a < s * counter:
    ans = b*(counter-1)
    if a - (s * (counter-1)) <= b:
      ans += a - (s * (counter-1))
    else:
      ans += b
    break
  else:
    counter += 1

print(ans)


# Optimized solution
a,b,c = list(map(int,input().split()))

s = b + c

counter = a//s
ans = b*counter
if a - (s * counter) <= b:
  ans += a - (s * counter)
else:
  ans += b

print(ans)
# Original solution
N,A,B =list(map(int,input().split()))
D =[]
for i in range(N):
    for j in range(A):
        D.append("A")
    for k in range(B):
        D.append("B")

#print(D)

F =D[0:N]
#print(F)
print((F.count("A")))


# Optimized solution
N,A,B =list(map(int,input().split()))

v = N//(A+B)
z = N %(A+B)

if z < A:
    print((A*v + z))
else:
    print((A*v + A))
# Original solution
N, A, B = list(map(int, input().split()))

C = N // (A + B) * A
D = N % (A + B)

E = 0
for i in range(D):
    if 0 < (i + 1) % (A + B) <= A:
        E += 1
        
print((C+E))

# Optimized solution
N, A, B = list(map(int, input().split()))

C = N // (A + B) * A
D = N % (A + B)

if 0 <= D and D <= A:
    print((C + D))
else:
    print((C + A))
# Original solution
N, A, B = list(map(int, input().split(' ')))
blue = ''
red = ''
count = int(N / (A + B))

for i in range(A):
    blue = blue + 'b'
for i in range(B):
    red = red + 'r'
one_roop = blue + red
string = ''
for i in range(count):
    string = string + one_roop

if N % (A + B) != 0:
    string = string + one_roop[0:N % (A + B)]

print((string.count('b')))

# Optimized solution
N, A, B = list(map(int, input().split(' ')))

count = int(N / (A + B))
blue_balls = count * A

if N % (A + B) != 0:
    if N % (A + B) > A:
        blue_balls += A
    else:
        blue_balls += N % (A + B)

print(blue_balls)
# Original solution
N, A, B = list(map(int, input().split()))
l = []
l_a = ['b' for i in range(A)]
l_b = ['r' for i in range(B)]
for val in range(N):
    l += l_a
    l += l_b
cnt = 0
for val in range(N):
    if l[val] == 'b':
        cnt += 1
print(cnt)

# Optimized solution
N, A, B = list(map(int, input().split()))
x = N // (A + B)
y = N % (A + B)
if y < A:
    print((x*A + y))
else:
    print((x*A + A))
# Original solution
n,a,b=list(map(int,input().split()))
x=n%(a+b)
y=n//(a+b)
c=list(i for i in range(1,a+1))
if x in c:
    print((a*y+x))
elif x==0:
    print((a*y))
else:
    print((a*(y+1)))

# Optimized solution
n,a,b=list(map(int,input().split()))
x=int(n/(a+b))
y=n%(a+b)
if a==0:
    print((0))
elif y==0:
    print((a*x))
elif 0<y<a+1:
    print((a*x+y))
else:
    print((a*(x+1)))
# Original solution
N, A, B=list(map(int,input().split()))
llist=[N]
for i in range(N-1):
    if i<A or (i>B+1) and A>1  :
       llist.append("blue")
    else :
        llist.append("red")
print((llist.count("blue")))

# Optimized solution

n, a, b = list(map(int, input().split()))
period = a+b
times = n//period
k = n%period
n =  a if k >a else k
print((times*a + n))
# Original solution
N, A, B = list(map(int, input().split()))

C = N // (A + B) + (0 if N % (A + B) == 0 else 1)

blue = 0
total = 0

while total < N:
    addition = min(N - total, A + B)
    total += addition
    blue += min(addition, A)

print(blue)

# Optimized solution
N, A, B = list(map(int, input().split()))

C = N // (A + B)
D = N % (A + B)

R = C * A + min(A, D)
print(R)
# Original solution
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, A, B = list(map(int, sys.stdin.readline().split()))

    ret = 0
    cnt = N // (A + B)

    if N % (A + B) == 0:
        print((int(A * cnt)))
    elif N < A + B:
        print((min(N, A)))
    else:
        ret += A*cnt
        if N - (A+B)*cnt <= A:
            ret += N - (A+B)*cnt
        else:
            ret += A

        print(ret)


if __name__ == '__main__':
    main()


# Optimized solution
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, A, B = list(map(int, sys.stdin.buffer.readline().split()))
    n = N//(A+B)
    m = N%(A+B)
    print((A*n + min(m, A) if m > A else A*n + m))


if __name__ == '__main__':
    main()
# Original solution
n,a,b=list(map(int,input().split()))
full=[]
while len(full)<n:
    for _ in range(a):
        full.append("b")
    for _ in range(b):
        full.append("r")
if len(full)>n:
    del full[n:-1]
print((full.count("b")))


# Optimized solution
N, A, B = list(map(int, input().split()))
 
m = N%(A+B)
 
print(((N//(A+B))*A + (A if m > A else m)))
# Original solution
n,a,b=list(map(int,input().split()))
aa=n//(a+b)
ss=n%(a+b)
ans=0
for i in range(aa):
    ans+=a
if ss>a:
    ans+=a
else:
    ans+=ss

print(ans)

# Optimized solution
n,a,b=list(map(int,input().split()))
aa=n//(a+b)
ss=n%(a+b)
ans=0
ans=ans+aa*a
if ss>a:
    ans+=a
else:
    ans+=ss

print(ans)
# Original solution
N,A,B=list(map(int,input().split()))
count=0
while N>0:
  for i in range(A):
    if N>0:
      count+=1
      N-=1
    else:
      break
  for i in range(B):
    if N>0:
      N-=1
    else:
      break
print(count)

# Optimized solution
N,A,B=list(map(int,input().split()))
a=int(N//(A+B))
b=N%(A+B)
if b>A:
  b=A
print((A*a+b))
# Original solution
N,A,B = list(map(int,input().split()))
k = N//(A+B)
m = N%(A+B)
if m>=A:
    n = A
else:
    n = m
print((k*A+n))

# Optimized solution
N,A,B = list(map(int,input().split()))
n = N//(A+B)
k = N%(A+B)
n1 = min(k,A)
print((A*n+n1))
# Original solution
N,A,B = list(map(int,input().split()))
n = N//(A+B)
m = N%(A+B)
k = min(m,A)
print((n*A+k))

# Optimized solution
N,A,B = list(map(int,input().split()))
a = N//(A+B)
b = N%(A+B)
if b>A:
    print((a*A+A))
else:
    print((a*A+b))
# Original solution
N, A, B = input().rstrip().split(' ')
N = int(N)
A = int(A)
B = int(B)
n = int(N / (A+B)) * A
m = N % (A+B)

b = ''
r = ''
br = ''
for _ in range(A):
    b += 'b'
for _ in range(B):
    r += 'r'
br = b+r
print((n + br[:m].count('b')))

# Optimized solution
N, A, B = input().rstrip().split(' ')
N = int(N)
A = int(A)
B = int(B)

n = int(N / (A+B)) * A
m = N % (A+B)

if m > A:
    m = A
print((n + m))
# Original solution
def main():
  n,a,b = list(map(int,input().split()))
  blue=""
  red=""
  for i in range(0,a):
    blue+='b'
  for i in range(0,b):
    red+='r'
  ans=""
  while n>len(ans):
    ans+=blue
    ans+=red
  print((ans[:n].count('b')))
main()

# Optimized solution
def main():
  n,a,b = list(map(int,input().split()))
  ans=0
  count=int(n/(a+b))
  ans+=count*a
  amari=n-count*(a+b)
  if amari <= a:
    ans+=amari
  else:
    ans+=a
  print(ans)
main()
# Original solution
L = input().split()
N = int(L[0])
A = int(L[1])
B = int(L[2])
blue = 0
for i in range(N):
    if i % (A + B) >= 0 and i % (A + B) <= (A - 1):
        blue += 1
print(blue)

# Optimized solution
In = input().split()
N = int(In[0])
A = int(In[1])
B = int(In[2])
x = N // (A + B)
y = N - (A + B)*x
ans = x * A
if y <= A:
    ans += y
else:
    ans += A
print(ans)
# Original solution
line = input().rstrip().split(' ')
n = int(line[0])
a = int(line[1])
b = int(line[2])

i = 0
ans = 0
while i <= n:
    if i + a <= n:
        ans += a
    else:
        t = n - i
        ans += t
    i += a + b

print(ans)

# Optimized solution
line = input().rstrip().split(' ')
n = int(line[0])
a = int(line[1])
b = int(line[2])

i = 0
ans = 0

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

if n > (a + b) * t:
    t2 = n - (a + b) * t
    if t2 > a:
        ans += a
    else:
        ans += n - (a + b) * t

print(ans)
# Original solution
N, A, B = list(map(int, input().split(' ')))


def main():
    blue = red = 0

    for i in range(10 ** 100):
        blue += A

        if blue + red > N:
            blue -= blue + red - N
            break

        red += B

        if blue + red > N:
            red -= blue + red - N
            break

    return blue


print((main()))


# Optimized solution
N, A, B = list(map(int, input().split(' ')))


def main():
    blue = (N // (A+B)) * A

    blue += min(A, N % (A+B))

    return blue


print((main()))