Measurement of the reaction e+e− → γγ at CMS energies from 9.4 to 31.6 GeV