weights (items of the same weight are indistinguishable). You want to pack a parcel whose weight, the sum of the weights inside, falls between low and high inclusive.
Count the **distinct** parcels. Two parcels are the same if they contain the same number of items of every weight. An item of weight x can be used at most as many times as x appears in weights. An empty parcel weighs 0.
The answer can be large, so return it modulo 10⁹ + 7.weights=[1, 1, 3], low=2, high=4 → 3
The bundles {1, 1} (weight 2), {3} (weight 3) and {1, 3} (weight 4) fit. {1, 3} is counted once even though either 1 could be picked.
weights=[0, 2, 2], low=0, high=2 → 4
The empty bundle, {0}, {2} and {0, 2} fit: the weightless item doubles the number of options.
weights=[5, 6], low=1, high=4 → 0
weights is at most 2·10⁴weights=[1, 1, 3], low=2, high=4
3
Run checks the first 3 tests in your browser. Submit checks all 86 tests on the server, hidden ones included.