Solution of the Master Equation for an Attenuated or Amplified Nonlinear Oscillator with an Arbitrary Initial Condition