Distributed-gain and optimum length of erbium-doped fibre amplifiers