snack-ruiner

In India IPL is on full swing now. Fans of cricket love watching the game and seeing ball by ball with having Snacks. Yummy, crispy snacks. Ankit and his friends are one of them.

One night, while watching his Favourite team's Match he is eating Snacks. His team is leading the game and so his enjoyment growing ball by ball. Ankit and his friends found that healthier the Sanck they eat , their Team leads.

So on this concept they are eating alot of Snacks. Suddenly Ankit got that he ate up a bad Snack and his team lost a Wicket. Ankit went into so much of stress thinking that if he will have another bad Snack it will cost to his supporting Team.

So he decide to avoid eating bad Snacks. But he needs your help to achieve this. He will give you an integer N (Number of Snacks he brought) and the an array D of floating-point values telling that he thinks ith number of Snack can be faulted with a chances of D[i]. And an array F containing floating-point values denoting that chances if ith Snack is faulted then Overall Snack will be faulted by F[i].

Then your task is to answer him the indexing value you think that can have faulted Snack followed
by a space with the probability of the Snack to be faulted.

Note that, Probability should have three decimal after floating-point.

Input : First line will contains an Integer T , number of Test Cases. Next T lines will have one integer N. The next two lines will contain N flaoting-point values , D[] and then F[]

Output : For each Test Case give the output in new line.

Constraints

1 ≤ T ≤25

3 ≤ N ≤ 30

0.0 ≤ D[i], F[i] < 1.0

Note :- To be Eligible for Prizes you have to register and create your home address maptag.

Important Update :  The problem is based upon a concept of Probability. All candidates are requested to please go through the Problem Statement carefully once again.

Click here to create your Maptag

SAMPLE INPUT
1
3
0.2 0.3 0.1
0.5 0.6 0.9

SAMPLE OUTPUT
1 0.486

Source: hackerearth | Difficulty: MEDIUM


Solutions:
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
t=int(input())
while t:
	t=t-1
	n=int(input())
	d=list(map(float,input().split()))
	f=list(map(float,input().split()))
	sum=0
	for i in range(0,n):
		sum=sum+d[i]*f[i]
		
	arr=[]
	p=0
	for i in range(0,n):
		pro=d[i]*f[i]/sum
		arr.append(pro)
		if(pro>p):
			p=pro
	print(arr.index(p),"%.3f"%max(arr))
	p=0
	sum=0