|John is playing with balls. All of the balls are identical in weight and considered to have a zero radius. All balls are located on the same straight line and can move only along this line. If a ball rolling to the right and a ball rolling to the left at the same speed collide, they do not change speed, but they change direction.
You are given int x. x[i] is the initial position of the i-th ball. John decides the direction for each ball (right or left) with equal probability. At time 0, he rolls the balls in the chosen directions simultaneously at a speed of one unit per second. Return the expected number of bounces between all balls during T seconds (including those collisions that happen exactly at T seconds).
|-||There is no friction. Each ball continues rolling at the same speed forever.|
|-||Your return value must have an absolute or relative error less than 1e-9.|
|-||x will contain between 1 and 12 elements, inclusive.|
|-||Each element of x will be between 0 and 100,000,000, inclusive.|
|-||All elements of x will be distinct.|
|-||T will be between 1 and 100,000,000, inclusive.|