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

    c = a+b

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

    stop
end program