# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

**“Cover your nose and mouth with a bent elbow or tissue when you sneeze or cough.”**

World has defeated the Corona Virus. But, recently another virus spread out, which is named Morona Virus. If anyone got infected with this virus, he/she must die.

This virus has some drawbacks. It can infect someone while it’s a **bad weather** (such as high temperature, low temperature, rain etc). But, when the weather isn’t good and if someone gets out of home, he/she will be infected for sure.

Mr. hikiko is a daily worker. He has to go out to earn money. When he is at home, he can also earn some little money by doing some freelancing work. When there is no risk, he will go out, else he will stay home.

Now, assume there are **n** days in a year and also **m** kind of **bad weather** can happen every day. You are given the probabilities of these **bad weather** to happen for every day. And also you know how much money Mr. Hikiko can earn by going out to work or doing some freelancing work by staying home. You have to calculate the Expected amount of money Mr. Hikiko can earn from this year.

You can learn more about Expected Value from here.

First line contain two integer **n** (1 ≤ **n** ≤ 1e5), the number of days in this year and **m**(1 ≤ **m** ≤ 9), the number of **bad weather** can happen every day.

Next of every **n** line contain **m** integers on each line, where **ith** integer represent the probability of happening **ith** **bad weather** on that day.

Next line contains **n** integers where, **ith** integer represents the amount of money Mr Hikiko can earn if he goes out to work at **ith** day.

Next line contains **n** integers where, **ith** integer represents the amount of money Mr Hikiko can earn by doing freelancing work at **ith** day.**Note:** Probabilities are given as percentage (0 ≤ **p** ≤ 100) and earning amount can be **0**TK to **5000**TK.

Print the Expected amount of money Mr. Hikiko can earn from this year. It can be shown that the expected value can be represented as **P/Q** where **P** and **Q** are co-prime integers. Print the value of P.Q-1 (mod 1e9+7).

Input | Output |
---|---|

1 2 50 50 4 4 | 4 |

Login to submit