add segment tree template from by