  implicit none
  integer(8) :: N, A,B
  integer(8) :: i
  integer(8) :: out, tmp1, tmp2
  read(*,*) N,A,B
  tmp1 = mod (N,A+B)
  tmp2 = N/(A+B)
  out = tmp2*A + min(tmp1,A)
  write(*,'(i0)') out
end
