Precision measurement of the (e++e-) flux in primary cosmic rays from 0.5 GeV to 1 TeV with the alpha magnetic spectrometer on the international space station