program sample
    implicit none
  
    integer(8) :: i,j,m,n,a,b
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) n,a,b
    if (a==0)then
        write(*,*)0
    end if

    m=(n/(a+b))*a
    if (mod(n,a+b)<=a)then
        m=m+mod(n,a+b)
    else
        m=m+a
    end if
  
    write(*,*) m
  
    stop
end program sample
  

