P7385 "EZEC-6" Jump Jump

Background

![](https://cdn.luogu.com.cn/upload/image_hosting/zq0mhuy7.png) Xiao A has recently become obsessed with the game "Jump Jump".

Description

The rules of the "Jump Jump" game played by Xiao A are as follows: 1. Set a counter $\text{cnt}$, and initialize it to $2$. 2. If you jump to the next tile but do **not** land on its center, gain $1$ point and reset $\text{cnt}$ to $2$. 3. If you jump to the next tile and land on its center, gain $\text{cnt}$ points and double $\text{cnt}$. 4. If the next tile is a special tile $x_i$ and you land on its center, gain an extra $y_i$ points. 5. The game ends when you fail to jump to the next tile, or when you have finished jumping all tiles. It is known that there are $n$ tiles in total, numbered from $1$ to $n$ (excluding the starting tile). The probability that Xiao A jumps to the next tile but **does not** land on its center is $a\%$. The probability that he jumps to the next tile and **does** land on its center is $b\%$. The remaining $(100-a-b)\%$ is the probability that he fails to jump to the next tile. Compute his expected score, modulo $10^9+7$.

Input Format

The first line contains three integers $n,a,b$. The second line contains an integer $m$, indicating that there are $m$ special tiles. The next $m$ lines each contain two integers $x,y$, indicating the index of a special tile and its extra bonus score. It is guaranteed that all $x$ are distinct.

Output Format

Output one integer, the expected score.

Explanation/Hint

**[Sample 1 Explanation]** Xiao A always jumps to the next tile and lands on its center, so the expected score is $2+4+8=14$ points. **[Sample 2 Explanation]** Xiao A always jumps to the next tile but does not land on its center, so the expected score is $1+1+1=3$ points. **[Sample 3 Explanation]** Xiao A can never jump to the next tile, so the expected score is $0$ points. **[Sample 4 Explanation]** Xiao A always jumps to the next tile and lands on its center, so the expected score is $2+10+4+10+8+10=44$ points. **[Constraints and Notes]** **This problem uses bundled testdata.** In the table below, a slash means there is no special restriction. | Subtask | Points | $n$ | $a$ | $b$ | $m$ | | :----------: | :----------: | :----------: | :----------: | :----------: | :----------: | | $1$ | $1$ | $=1$ | $=50$ | $=50$ | / | | $2$ | $9$ | $\le 20$ | / | / | $=0$ | | $3$ | $10$ | $\le 20$ | / | / | / | | $4$ | $10$ | $\le 10^5$ | / | / | $=0$ | | $5$ | $20$ | $\le 10^5$ | / | / | / | | $6$ | $5$ | / | $=0$ | $=100$ | / | | $7$ | $5$ | / | $=100$ | $=0$ | / | | $8$ | $15$ | / | / | / | $=0$ | | $9$ | $25$ | / | / | / | / | For $100\%$ of the testdata, $1\le n\le 10^{18}$, $0\le a,b,a+b\le 100$, $0\le m\le \min(n,10^5)$, $1\le x\le n$, $1\le y\le 100$. Translated by ChatGPT 5