You have an array $$$a$$$ which is initially empty. You have to process $$$q$$$ queries of the following types on your array.
The balance of an array $$$b = [b_1, b_2, \ldots, b_m]$$$ is defined as $$$$$$ \text{balance}(b) = \frac{1 \cdot b_1 + 2 \cdot b_2 + \ldots + m \cdot b_m}{m}. $$$$$$
$$$^{\text{∗}}$$$$$$\lceil k \rceil$$$ is the $$$k$$$ rounded up, i. e. the smallest integer greater than or equal to $$$k$$$.
$$$^{\text{†}}$$$A sequence $$$b$$$ is a subsequence of a sequence $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by the deletion of several (possibly, zero or all) element from arbitrary positions. Two subsequences are considered different if the sets of positions of the deleted elements are different.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows.
The first line of each test case contains a single integer $$$q$$$ ($$$2 \leq q \leq 10^6$$$), denoting the number of queries. The next $$$q$$$ lines describe the queries:
It is also guaranteed that each test case contains at least one query of the third type, and that the total sum of $$$q$$$ over all test cases does not exceed $$$10^6$$$.
For each query of type 3, output the desired sum of balances.
Formally, let $$$M = 10^9+7$$$. It can be shown that the exact answer can be expressed as an irreducible fraction $$$\frac{P}{Q}$$$, where $$$P$$$ and $$$Q$$$ are integers and $$$Q \not \equiv 0 \pmod{M}$$$. Output the integer equal to $$$P \cdot Q^{-1} \bmod M$$$. In other words, output such an integer $$$x$$$ that $$$0 \le x \lt M$$$ and $$$x \cdot Q \equiv P \pmod{M}$$$.
252 12 2313102 3353212 9385562 5595032 35311531313
8333333557856804480553793656724179701
In the first test case, the array $$$a$$$ is initially empty.
After the first query, the array becomes $$$[1]$$$.
After the second query, the array becomes $$$[2,\, 1,\, 2]$$$.
In the third query, the subsequences of $$$a$$$ and their balances are as follows:
Thus, the total sum of balances is: $$$$$$\frac{95}{6}.$$$$$$
After the fourth query, the array $$$a$$$ becomes $$$[2,\,2]$$$.
| Name |
|---|


