P27101 [AtCoder] Open the Door
NOI
题目描述

Problem Description

There is a locked door in front of you. The locksmith has $ N $ keys, and exactly one of them is the correct key. The probability that the $ i $ th key is the correct key is $ p_i $ %.

The door is poorly made, so even if you choose the correct key, the door may not open. The probability of the door opening when attempting to use the $ i $ th key is as follows:

  • If the $ i $ th key is the correct key: The door opens with a probability of $ q_i $ %. If attempted multiple times, each attempt is judged independently.
  • If the $ i $ th key is not the correct key: The door does not open.

You start with $ K $ yen. You will continue the following operation until the door opens or your money runs out to $ 0 $ yen.

  • Pay $ 1 $ yen to the locksmith. Choose one key from the locksmith and attempt to open the door once. Then, return the key.

Your goal is to maximize the expected value of the remaining money when the operation ends. Find the maximum expected value when operating optimally.

Input Format

The input is given from the standard input in the following format:

$ N $ $ K $ $ p_1 $ $\ldots$ $ p_N $ $ q_1 $ $\ldots$ $ q_N $

Output Format

Output the answer in one line. It is considered correct if the absolute or relative error is within $ 10^{-6} $.

Sample Input and Output

Sample Input #1

2 2
50 50
50 50

Sample Output #1

0.25

Sample Input #2

1 2
100
100

Sample Output #2

1

Sample Input #3

10 20
10 10 10 20 6 5 4 8 12 15
10 20 30 40 50 60 70 80 90 10

Sample Output #3

8.2045400000000000031

Notes/Hints

Constraints

  • All inputs are integers.
  • $1 \le N, K \le 100$
  • $1 \le p_i, q_i \le 100$
  • The sum of $ p_i $ is $ 100 $

Sample Explanation 1

Consider the strategy of choosing the first key if you have $ 1 $ yen or more left and the door is not open. With a probability of $ 25 $ %, you have $ 1 $ yen left, and with a probability of $ 75 $ %, you have $ 0 $ yen. The expected value of the remaining money is $ 0.25 $ yen, which is actually the maximum expected value.

Sample Explanation 2

You should choose the first key.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 2 50 50 50 50
样例输出
0.25