maxsum and sorts