      PROGRAM piyo
      IMPLICIT NONE
      integer(16) :: n,a,b,num,amari,ans
      
      read*,n,a,b
      
      if( a+b>=n )then
        print*,a
        stop
      end if
      
      if( (a+b)*(10_16**100_16)>=n )then
        print*, a*(10_16**100_16)
        stop
      end if
      
      ans = 0
      
      num = n/(a+b)
      amari = n - (a+b)*num
      
      if( a>=amari )then
        ans = ans + amari
      else
        ans = ans + a
      end if
      
      ans = ans + num*a
      print*,ans
      
      
      
      END PROGRAM