write sums of selections