A new approach to calculation of electron affinities