[impl] sum algorithm