A simple multifoil spectrometer for routine carbon and oxygen measurements