Input gscar Output sorted energy and free energy