Add sum() for TreeMultiset. Also tweak extend implementation