Summation of the perturbation series for the energy levels of a hydrogen atom in a magnetic field