Determination of the chemical potentials of polymeric systems from Monte Carlo simulations