407629: GYM102861 H SBC's Hangar
Description
A small cargo plane of the System of Binary Cargos (SBC) was designed to transport special and secret products. These products are grouped in boxes with different weights.
The plane has a safety weight range, within which the aircraft is stable. More specifically, there is an interval such that if the total weight of the boxes carried is not in the interval, then it will not be possible to guarantee the security of the flight.
It is known that all boxes have different weights. Moreover, given any two boxes, the heavier one weighs at least twice as much as the lighter box.
Your task is to determine in how many ways you can choose a specified number of these boxes to be transported on the plane without destabilizing it.
InputThe first line of the input contains two integers, $$$N$$$ and $$$K$$$, representing respectively the number of available boxes and the specified number of boxes to be loaded in the plane.
The second line of the input contains $$$N$$$ integers, separated by a space, and representing the weights of the boxes.
The third line of the entry contains two integers, $$$A$$$ and $$$B$$$, which specify the weight safety range, which is the (closed) interval $$$[A, B]$$$.
Consider all weights reported in the same unit.
- $$$1 \le N \le 50$$$
- $$$1 \le K \le 50$$$
- the weight $$$W$$$ of each box is in the interval $$$1 \le W \le 10^{18}$$$
- $$$1 \le A \le B \le 2 \times 10^{18}$$$
The output consists of a single line containing the number of possible ways to choose the specified number of boxes without jeopardizing the flight.
ExamplesInput3 2 10 1 3 4 13Output
3Input
4 3 20 10 50 1 21 81Output
4Input
6 3 14 70 3 1 6 31 10 74Output
11