modified segtree