There is a straight road that passes through N short tunnels. At the entrance to the first tunnel, there are C cars lined up in a row waiting to enter the series of tunnels. The distance between each pair of consecutive tunnels is D metres (the lengths of each tunnel and each car are negligible) and the velocity of each car is S metres per second.

Each tunnel contains a toll booth. In the i-th tunnel (1 ≤ i ≤ N), processing a car at the toll booth takes Ai seconds. Only one car can be processed at the same time. If there are multiple cars in the tunnel, they all have to wait for the first car to be processed; afterwards, the first car exits the tunnel, the second car starts being processed and all remaining cars have to wait again, etc. Whenever a car arrives in a tunnel, it has to wait at that tunnel's toll booth until all previous cars have been processed and then get processed itself.

The road and the tunnels are too narrow, so cars can't overtake each other at any time during the journey.

Chef is after Reziba once again. Reziba's car is the first car to enter the tunnels, while Chef's car is the last car to enter the tunnels.

Compute the final delay (in seconds) between the first (Reziba's) car and the last (Chef's) car immediately after Chef's car exits the last tunnel, i.e. after all the cars have passed through the tunnels. This delay is equal to the distance between the first and the last car divided by the cars' velocity, or equivalently to the difference between the times when the last car and the first car exit the last tunnel.

### Input

- The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
- The first line of each test case contains a single integer N denoting the number of tunnels.
- The second line contains N space-separated integers A1, A2, ..., AN denoting the time taken for processing a car at each toll booth.
- The third line contains three space-separated integers C, D and S.

### Output

For each test case, print a single line containing one real number — the time delay between the first and last car after all the cars have passed through all the tunnels. Your answer will be considered correct if its absolute error is less than 10-6.

### Constraints

- 1 ≤ T ≤ 100
- 1 ≤ N ≤ 105
- 1 ≤ Ai ≤ 109 for each valid i
- 2 ≤ C ≤ 106
- 1 ≤ D, S ≤ 109

### Subtasks

Subtask #1:

- 1 ≤ N ≤ 1,000
- C = 2

Subtask #2: Original Constraints

### Sample 1:

2 3 2 2 2 3 5 5 2 3 2 2 1 1

4.000000000 3.000000000

### Explanation:

Example case 1: Each car takes 5/5 = 1 second to go from one tunnel to the next tunnel.

Since each car has to wait for equally long (2 seconds) in each tunnel, the delay between every two consecutive cars exiting each tunnel is 2 seconds.

As there are 3 cars, the total time delay between the first and the last car after the last tunnel is 4 seconds.

** Code(C++):-**

__Code(JAVA):-__

import java.util.*;import java.lang.*;import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */class Codechef{ public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner sc = new Scanner(System.in); int T = sc.nextInt(); while(T-->0){ int n = sc.nextInt(); long[] arr = new long[n]; long max = Long.MIN_VALUE; for(int i=0;i<n;i++){ arr[i]= sc.nextLong(); max= Long.max(max,arr[i]); } long c = sc.nextLong(); long d = sc.nextLong(); long s = sc.nextLong(); System.out.println((c-1)*max); } }}

__Code(JAVA):-__

import java.util.*;import java.lang.*;import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */class Codechef{ public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner sc = new Scanner(System.in); int T = sc.nextInt(); while(T-->0){ int n = sc.nextInt(); long[] arr = new long[n]; long max = Long.MIN_VALUE; for(int i=0;i<n;i++){ arr[i]= sc.nextLong(); max= Long.max(max,arr[i]); } long c = sc.nextLong(); long d = sc.nextLong(); long s = sc.nextLong(); System.out.println((c-1)*max); } }}

__Recommended Post ____:-__

__Recommended Post__

__:-__

__HCL Coding Questions:-__

__Capgemini Coding Questions:-__

__iMocha coding Questions:-__

__Tech Mahindra coding questions:-__

__Unthinkable Solutions coding questions:-__- Swap the adjacent characters of the string
- Double the vowel characters in the string
- Character with their frequency
- Program to find the closest value

__Must check this:-__

__Companies interview:-__- Swap adjacent characters
- Double the vowel characters
- Check valid parenthesis
- Print the characters with their frequencies
- Find closest value
- Word Count
- Program of CaesarCipher
- Program to find the perfect city
- Annual Day | Tech Mahindra coding question
- Find the number of pairs in the array whose sum is equal to a given target.

__Full C course:- __

__Key points:-__

- How to set limit in the floating value in python
- What is boolean data type
- How to print any character without using format specifier
- How to check that given number is power of 2 or not
- How to fix limit in double and floating numbers after dot (.) in c++
- How to print a double or floating point number in scientific notation and fixed notation
- How to take input a string in c
- How to reduce the execution time of program in c++.

__Cracking the coding interview:-__

__Array and string:-__

__Tree and graph:-__

__Hackerearth Problems:-__

- Very Cool numbers | Hacker earth solution
- Vowel Recognition | Hackerearth practice problem solution
- Birthday party | Hacker earth solution
- Most frequent | hacker earth problem solution
- program to find symetric difference of two sets
- cost of balloons | Hacker earth problem solution
- Chacha o chacha | hacker earth problem solution
- jadu and dna | hacker earth solution
- Bricks game | hacker earth problem
- Anti-Palindrome strings | hacker earth solution
- connected components in the graph | hacker earth data structure
- odd one out || hacker earth problem solution
- Minimum addition | Hackerearth Practice problem
- The magical mountain | Hackerearth Practice problem
- The first overtake | Hackerearth Practice problem

__Hackerrank Problems:-__- Playing With Characters | Hackerrank practice problem solution
- Sum and Difference of Two Numbers | hackerrank practice problem solution
- Functions in C | hackerrank practice problem solution
- Pointers in C | hackerrank practice problem solution
- Conditional Statements in C | Hackerrank practice problem solution
- For Loop in C | hackerrank practice problem solution
- Sum of Digits of a Five Digit Number | hackerrank practice problem solution
- 1D Arrays in C | hackerrank practice problem solution
- Array Reversal | hackerrank practice problem solution
- Printing Tokens | hackerrank practice problem solution
- Digit Frequency | hackerrank practice problem solution
- Calculate the Nth term | hackerrank practice problem solution

__Data structure:-__

- Program to find cycle in the graph
- Implementation of singly link list
- Implementation of queue by using link list
- Algorithm of quick sort
- stack by using link list
- program to find preorder post order and inorder of the binary search tree
- Minimum weight of spanning tree
- Preorder, inorder and post order traversal of the tree

__ MCQs:-__

## 0 Comments