lexicographical order by sum