Friend's Trip

4

6 votes
Problem

David's school is planning to take some students from him class on a field trip. David is really excited about it. Thime are a total of S students in him class. But due to budget constraints, the school is planning to take only N students for the trip. These students will be picked randomly. And each student has equal chance of being picked.

David's friend circle has M students including him. Though he is excited about the field trip, he will enjoy it only if thime are at-least K of him friends with him on the trip. He is wondering what are the chances of that happening. he needs your help. Tell him the probability that he will enjoy given that he goes on the trip.

INPUT

  • First line of input contains a single integer T, the number of test cases.
  • Each test starts with a single line having 4 space separated integers, S, N, M and K.

OUTPUT

For each test case, output a line containing the required probability. The answer will be accepted if the relative error is not more than 10^-6.

CONSTRAINTS

1 ≤ T ≤ 100

1 ≤ S ≤ 1000

1 ≤ N ≤ S

1 ≤ M ≤ S

0 ≤ K < M

Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

Every student will be taken to the trip. So all her 4 friends will accompany her to the trip no matter what.

Editor Image

?