Winning Badges

Time Limit: 13 Seconds

Memory Limit: 65536 KB


You are standing in front of a game center. What you are going to do is to play a game called "Beat Me" and win no less than B badges.

Despite the complex rules of the game, the result is simple. After each game, you will have an integer score ranged from 0 to 100. There are 3 fixed integers a, b and c. If your score is

  • no less than a, you will get na badges.
  • no less than b but less than a, you will get nb badges.
  • no less than c but less than b, you will get nc badges.
  • less than c, you will get no badges.

You know the game well, and you have figured out a way to play such that you can have the same probability to get every score from 0 to 100. It is the best way ever and is what you are to take.

Of course, you don't have to worry about money. You always have sufficient money to play and you only concentrate on getting B badges.

Here comes the question. What is the expected number of games you will play to get no less than B badges.


The first line of the input contains an integer T (T ≈ 100) indicating the number of test cases. Then T cases follow.

For each case, there is only one line containing 7 integers a, b, c, na, nb, nc, B (0 < c < b < a < 100, 1 ≤ na, nb, nc ≤ 10000, 1 ≤ B ≤ 109).


For each case, print one line containing the answer. Answers with relative or absolute error less than 10-6 to any of the outputs will be accepted.

Sample Input

75 50 25 5 5 5 5
75 50 25 5 5 5 6

Sample Output