optimize sum-demo