Hide

Problem Q
Krumpirko

Young Mr. Potato is opening two new stores where he will, you guessed it, sell potatoes. Mr. Potato gets his potatoes from $N$ farmers. Each farmer offers exactly $a_ i$ potatoes per bag for a total price of $c_ i$. Mr. Potato is going to buy all bags of potatoes from all farmers and place the bags in his two stores.

Let’s denote the average potato price in the first store with $P_1$, and the average potato price in the second store with $P_2$ . The average potato price in a store is equal to the ratio of the price and the total number of potatoes in the store. Taking into account logistical difficulties and the amount of potatoes in the stores, he wants the product of the average prices of potatoes in the stores to be minimal. In other words, he wants the product of $P_1$ and $P_2$ to be minimal.

After Mr. Potato settles on a division of bags in the stores, at least one store must have exactly $L$ bags.

Input

The first line of input contains two integers $N$ and $L$ ($2 \leq N \leq 100$, $1 \leq L < N$), the number of potato bags and the number of potato bags in at least one store. The second line of input contains $N$ integers $a_ i$ ($1 \leq a_ i \leq 100$), separated by space. The third line of input contains $N$ integers $c_ i$ ($1 \leq c_ i \leq 1\, 000\, 000$), separated by space. The sum of all $a_ i$ will be at most $500$.

Output

The first and only line of output must contain the minimal product of $P_1$ and $P_2$ from the task. An answer correct up to three decimal places will be accepted.

Sample Input 1 Sample Output 1
3 1
3 2 1
1 2 3
0.556
Sample Input 2 Sample Output 2
3 2
2 2 2
3 3 3
2.250

Please log in to submit a solution to this problem

Log in