improve sub sum