[mod] binary search on cumulative frequencies