Winning the Match

Time limit1sMemory limit128 MB

Problem

Consider a volleyball match between two teams, $A$ and $B$. Under the rules below, compute the probability that team $A$ wins the match.

  • The match is played by two teams, $A$ and $B$.
  • The first team to win $K$ games wins the match.
  • Each game consists of rounds; every round is won by exactly one team, which then scores one point in the current game.
  • The first team to reach $L$ points wins the game.
  • When team $A$ serves in a round, it wins that round with probability $Pa%$ (and loses it with probability $(100 - Pa)%$).
  • When team $B$ serves in a round, it wins that round with probability $Pb%$ (and loses it with probability $(100 - Pb)%$).
  • Except for the first round of a game, a round is served by the team that won the previous round.
  • Except for the first game of the match, the first round of a game is served by the team that did not serve the first round of the previous game.
  • In the very first round of the very first game of the match, each team is equally likely to serve.

Given $Pa$, $Pb$, $K$, and $L$, compute the probability, as a percentage, that team $A$ wins the match.

Input

The first line contains one integer: the number of data sets. Each data set is a single line with four integers $Pa$, $Pb$, $K$, and $L$, where $1 \le K \le 100$ and $1 \le L \le 100$, and $Pa$ and $Pb$ are integer percentages (so $0 \le Pa, Pb \le 100$).

Output

For each data set, print on its own line the required probability as a percentage, rounded to exactly one digit after the decimal point.