Save The Princess

All submissions for this problem are available.
Shiro is leading an army to save the princess of his kingdom "Abra". The princess has been made a prisoner by the neighboring kingdom "Kadabra". Kadabra is a magical land and is full of challenges. Shiro's army has to pass N levels before they can get to the princess. After each level, the army gets a few flags to carry along. The flags can either all be of kindom Abra OR all of kingdom Kadabra. The magic of Kadabra forces Shiro's army to carry the flags irrespective of which kingdom they belong to. The princess doesn't know Shiro or anyone from his army. She will not escape with them unless she can trust them. She will trust them only if the number of Abra's flags they are carrying is atleast as much as the number of Kadabra's flags.
The army gets a_{i} flags at the end of the i^{th} level. Probability that flags received at the end of the i^{th} level will be Abra's flags is p_{i}. Your task is to tell Shiro what is the probability that the princess will trust him once they reach her.
Input:
First line of input contains a single integer T, the number of test cases.
Each test starts with a single line having an integer, N, the number of levels in Kadabra.
Next line contains contains N integers with the i^{th} integer being a_{i} as described above.
Next line contains contains N integers with the i^{th} integer being p_{i} as described above. Note that the probabilities given will be in percents.
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 ≤ N ≤ 100 1 ≤ a_{i} ≤ 100 0 ≤ p_{i} ≤ 100
Example:
Input:
2 5 1 2 3 4 4 0 100 100 0 50 2 5 5 50 60
Output:
0.5000000 0.8000000
Update:
Difference in answer upto 1e6 will be ignored.
Author:  vamsi_kavala 
Tester:  white_king 
Editorial  http://discuss.codechef.com/problems/SHIRO 
Tags  aug13, dynamicprogramming, easy, simplemath, vamsi_kavala 
Date Added:  27032013 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 