program prob2
    implicit none
    integer(16)::n,a,b,c
    read(*,*) n,a,b

    c = a+b

    if(n <= a+b) then
        write(*,*) a
    else
        write(*,*) n - n/c * b
    end if 

    stop
end program