Love Choice
题号:NC252843
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

It’s the beginning of a new relationship. Will this one result in joy or sorrow? In LoveChoice, you choose the actions that determine how the relationship unfolds. Pick your responses to each of the situations. These endearing and bittersweet stories are surprisingly realistic and easy to relate to.



In order to perform better in a romantic relationship with Eva, Colin studies hard by playing LoveChoice on Steam. To simplify the problem, we describe it as follows:

There are n multiple-choice questions, the i-th question has a_i normal choices. In addition, some questions have another hidden choice. There is only one correct choice for each question, and if there is a hidden choice for this question, the hidden choice must be the correct choice.

In a round of game, you must answer all the questions in order. After answering all the questions, the system will tell you if each question is answered correctly.

Colin is calm enough. For each question, he will only choose one of the choices that may not be the wrong choice with equal probability each time. However, Colin's observation ability is relatively ordinary, so if a question has a hidden choice, Colin will only find out that there is a hidden choice after knowing that all the a_i normal choices for this question are wrong.

Colin is hardworking. His goal is to answer all questions correctly in a round. Please calculate the expected number of rounds for him to answer all the questions correctly for the first time.

输入描述:

The first line has two integers n,m \text{ } (1 \le m \le n\le 5\times 10^3) , represents there are n questions in the game and there are m questions has a hidden choice.

The second line has n integers a_1, a_2, \dots , a_n \text{ } ( 1 \le a_i \le 10^9) , represents there are a_i normal choices for the i-th question.

The third line has m different integers b_1, b_2, \dots, b_m \text{ } ( 1 \le b_i \le n) , represents the b_i-th question has a hidden choice.

输出描述:

Output a single integer, representing the expected number of rounds for him to answer all the questions correctly for the first time module 10^9+7 .
示例1

输入

复制
2 1
1 3
1

输出

复制
333333338

说明

The probability of answering all the questions correctly for the first time in the second round is \frac{2}{3} .

The probability of answering all the questions correctly for the first time in the third round is \frac{1}{3} .

So the answer of the example is \frac{2}{3}\times 2 + \frac{1}{3}\times 3=\frac{7}{3}, which modules 10^9+7 is  .