BasicData Analysis10 points

The 90th percentile delivery promise

A grocery delivery app in Singapore promises customers a delivery window. The operations team does not use the average, because a few very late orders hide behind it. They quote a percentile of the delivery times instead, and everyone must compute it the same way.

Task: line 1 holds the delivery times in minutes (integers separated by spaces, at least one value). Line 2 holds an integer p from 0 to 100. Sort the values ascending (x[0] is the smallest) and use linear interpolation: let pos = (n - 1) * p / 100, lo = floor(pos), frac = pos - lo. The answer is x[lo] + (x[lo + 1] - x[lo]) * frac; when lo is the last index the answer is simply x[lo]. Print the answer with exactly 2 decimals.

Sample tests

Input

30 25 41 22 60 35 28 52 31 45
90

Expected output

52.80

Input

12 18 25 40
50

Expected output

21.50

Your answer is also checked against 4 hidden tests.

Need a hint?

Work out the fractional position first, then split it into a whole index and a leftover fraction.