Smallest diagonal matrix sum