/* Written 7/12/07 by Ross Byers
 * Contains a solution to the contest problem heavy.doc
 */
 
 // Note: This solution will work for any set of positive weights,
 //       not just weights that add up to 100.
 
 import java.lang.*;
 import java.util.*;
 import java.io.*;
 
 public class heavy
 {
 	public static void main(String[] args) throws IOException
 	{
 		Scanner inFile = new Scanner(new File("heavy.in"));
 		double weight1, weight2, weight3, weight4, weight5;
 		int n = inFile.nextInt();
 		
 		// Read in all weights.
 		weight1 = inFile.nextDouble();
 		weight2 = inFile.nextDouble();
 		weight3 = inFile.nextDouble();
 		weight4 = inFile.nextDouble();
 		weight5 = inFile.nextDouble();
 		
 		// Loop through all students.
 		for (int i = 0; i < n; i++)
 		{
 			// Add in the contribution of each test score.
 			double sum = 0;
 			sum += weight1 * inFile.nextInt();
 			sum += weight2 * inFile.nextInt();
 			sum += weight3 * inFile.nextInt();
 			sum += weight4 * inFile.nextInt();
 			sum += weight5 * inFile.nextInt();
 			
 			// Dividing by the sum of the weights, gives the desired average.
 			double average = sum / (weight1 + weight2 + weight3 + weight4 + weight5);
 			System.out.println(average);
 		}
 	}
 }