$\space \space$*Standing, Genn watched the sunlight flicker on the calm ocean. His whole body hurt, but his mind was clearer than it had been in weeks. He waited a moment, certain that his thoughts would soon become filled with memories he’d rather forget. But none haunted him now. The ships were separating from the flotilla. Now, with the trouble averted, each unraveled its own bright sail and glided out farther over the sun-speckled sea.*
$\space \space$*“You said to me that this Archdruid Stormrage believes my people will be an important asset to the Alliance.”*
$\space \space$*“That I did.”*
$\space \space$*“Perhaps he is right, then…. Perhaps he is right.”*
Genn has a tree with $n$ vertices, **rooted** at vertex 1. As a master of data structure, he performs $m$ "access" operations to the tree in chronological order. For the $i^{th}$ operation, vertex $x_i$ will be "accessed": all edges on the **route** from vertex $x_i$ to the root will be painted color $c_i$. Meanwhile, the color of all other edges that have **exactly one** common vertex with the route will be reset to 0.
The value of the tree is defined as the sum of color on all edges after all operations are performed.
Unfortunately, painting on trees is really a dangerous task, so each operation has only $p_i$ probability to be performed successfully, and for probability $1-p_i$ the operation will be skipped and nothing will happen to the tree.
Genn wants to know the expected value of the tree **modulo $10^9+7$**.
Formally, let $M=10^9+7$. It can be demonstrated that the answer can be presented as a irreducible fraction $\dfrac{p}{q}$, where $p$ and $q$ are integers and $q\not\equiv 0 \pmod M$. Output a single integer equal to $p\cdot q^{-1} \bmod M$. In other words, output an integer $x$ such that $0\leq x < M$ and $x\cdot q \equiv p \pmod M$.