You are given a rooted tree consisting of
n vertices numbered from
1 to
n. The root of the tree is a vertex number
1.
Initially all vertices contain number
0. Then come
q queries, each query has one of the two types:
-
The format of the query: 1 v x k. In response to the query, you need to add to the number at vertex v number x; to the numbers at the descendants of vertex v at distance 1, add x-k; and so on, to the numbers written in the descendants of vertex v at distance i, you need to add x-(i·k). The distance between two vertices is the number of edges in the shortest path between these vertices.
-
The format of the query: 2 v. In reply to the query you should print the number written in vertex v modulo 1000000007 (109+7).
Process the queries given in the input.
Output
For each query of the second type print on a single line the number written in the vertex from the query. Print the number modulo
1000000007 (109+7).
Note
You can read about a rooted tree here:
http://en.wikipedia.org/wiki/Tree_(graph_theory).