max sum and gdc