program main
 implicit none
 integer :: a,b,n
  read *, n,a,b
   if (n<=a+b) then
    if (mod(n,a+b)==0) then
     write(*,'(i0)') b
    else if (mod(n,a+b)<=a) then
     write(*,'(i0)') 0
    else if (mod(n,a+b)>a) then
     write(*,'(i0)') mod(n,a+b)-a
    end if
   else if (n>a+b) then
    if (mod(n,a+b)==0) then
     write(*,'(i0)') b*n/(a+b)
    else if  (mod(n,a+b)<=a) then
     write(*,'(i0)') (n-mod(n,a+b))/(a+b)
    else if (mod(n,a+b)>a) then
     write(*,'(i0)') b*(n-mod(n,a+b))/(a+b)+mod(n,a+b)-a
    end if
   end if
  stop
end program main