First- and second-law efficiencies of the global and regional energy systems