P16758 [HackerEarth] HTML Generator Sample Page
普及
题目描述

HTML Generator Sample Page

        Yesterday night while walking under the street lights, We saw a drunk man. He was taking random steps. But there was something unique with his steps. He would either take a step North or South or East or West as if he was walking on a rectangular grid.

        After each step the drunk man selects on of the four directions and moves one step further in the selected direction. Assuming that there is a probability (given in percentage) associated for going in every direction ( East , West, North, South given by four integers E , W , N , S respectively). You have tell Abhisar what is the probability that after taking N steps the drunken man never visited a location more than once.

INPUT :
The input cantains T test cases. For each test case you will be five space separated integers , N (number of  steps taken by the drunken man), E , W , N , S (the percentage chance of selecting East , West, North or South direction respectively)

OUTPUT :
Output in a single line ,for each test case, a double value denoting the probability that after taking N steps the drunken man visited a point only once.

CONSTRAINTS :
0<T ≤ 100
1 ≤ N ≤ 14
0 ≤ E,W,N,S ≤ 100
the sum of E,W,N,S will always be 100SAMPLE INPUT
2
1 25 25 25 25
2 25 25 25 25

SAMPLE OUTPUT
1.000000
0.750000

输入格式

见题面

输出格式

见题面

样例输入
89 2 25 25 25 25 7 50 0 0 50 14 50 50 0 0 14 25 25 25 25 7 4 75 13 8 11 37 23 15 25 1 23 35 39 3 2 89 1 10 0 7 50 2 26 22 13 100 0 0 0 6 54 3 9 34 11 63 12 16 9 6 21 29 34 16 6 0 46 16 38 6 0 62 29 9 1 10 36 35 19 13 11 50 18 21 1 6 33 15 46 2 12 11 21 56 4 15 26 46 13 14 100 0 0 0 14 36 30 21 13 7 41 21 1 37 6 25 64 9 2 5 0 77 4 19 8 10 22 35 33 4 8 5 72 15 3 25 19 20 36 10 4 43 16 37 9 4 58 8 30 11 27 4 31 38 14 100 0 0 0 6 2 4 41 53 13 21 31 31 17 3 22 5 26 47 6 0 13 50 37 3 4 19 49 28 13 58 37 0 5 10 67 5 17 11 6 28 26 9 37 3 9 33 36 22 4 61 15 24 0 12 100 0 0 0 13 23 62 0 15 5 26 8 5 61 1 10 1 41 48 14 34 4 29 33 1 56 1 21 22 10 16 19 51 14 1 83 14 2 1 2 20 33 28 19 13 1 3 48 48 2 9 28 39 24 8 100 0 0 0 14 37 41 10 12 8 25 25 25 25 13 17 21 29 33 14 1 33 27 39 13 34 27 21 18 12 21 29 33 17 14 24 26 25 25 14 15 29 11 45 14 1 50 49 0 14 83 15 1 1 14 35 15 37 13 13 21 14 30 35 14 24 26 26 24 14 36 14 39 11 14 24 23 22 31 14 23 27 25 25 14 1 2 3 94 13 25 25 25 25 13 33 42 16 9 14 10 23 27 40 13 12 1 50 37 14 11 63 1 25 14 15 20 35 30 14 12 27 30 31 14 97 1 1 1 14 12 63 1 24 14 1 49 25 25 14 26 21 18 35 14 1 1 1 97 14 44 7 23 26 13 8 18 62 12 14 10 20 30 40 2 25 25 25 25 7 50 0 0 50 14 50 50 0 0
样例输出
0.750000 1.000000 0.000122 0.008845 0.675763 0.042825 1.000000 0.982200 0.454360 1.000000 0.649436 0.197070 0.240107 0.570534 0.788408 1.000000 0.093957 1.000000 0.738400 0.519938 1.000000 0.009000 0.352895 0.203845 0.944866 0.089190 0.540320 0.583220 0.257711 0.507924 0.057483 1.000000 0.067256 0.024470 0.559376 0.125334 0.528192 0.003400 0.442604 0.295187 0.622810 0.606824 1.000000 0.047035 0.686170 1.000000 0.046813 1.000000 0.140220 1.000000 0.761600 0.000723 0.762400 1.000000 0.003759 0.090271 0.012346 0.060206 0.013348 0.035003 0.008948 0.073101 0.904204 0.103486 0.050663 0.012741 0.009050 0.071322 0.010881 0.009257 0.650663 0.013135 0.009587 0.014926 0.006518 0.225299 0.008024 0.014371 0.866836 0.195293 0.186932 0.018033 0.866836 0.079516 0.146875 0.009919 0.750000 1.000000 0.000122