Sprinkler

아직 제출이 없습니다시간 제한4초메모리 제한1024 MB

문제

JOI-kun has years of experience of growing vegetables in his home vegetable garden. Now he is planning to manage IOI Farm.

IOI Farm consists of NN lands, numbered from 11 to NN. There are N1N - 1 roads connecting with lands, numbered from 11 to N1N - 1. The road ii (1iN11 ≤ i ≤ N - 1) connects the land A_iA\_i and the land B_iB\_i bidirectionally. It is possible to move from any land to any other land by passing through roads. There is a sprinkler in every land of IOI Farm. Using a sprinkler, we can spray water on surrounding lands.

JOI-kun is planning to grow JOI millets in IOI Farm. JOI millet is a curious plant. If we give water, the height of a JOI millet changes immediately. But, JOI millet is a weak plant. If the height of a JOI millet becomes larger than or equal to LL, the top part of length LL of the JOI millet is broken immediately. JOI-kun will harvest the broken parts of JOI millets.

In the beginning, JOI-kun plants a JOI millet of height H_jH\_j in the land jj (1jN1 ≤ j ≤ N). After that, for QQ days, JOI-kun will take care of the JOI millets everyday. On the kk-th day (1kQ1 ≤ k ≤ Q), JOI-kun takes one of the following actions.

  • Type 1 : JOI-kun uses the sprinkler of the land X_kX\_k to give water to every land whose distance from the land X_kX\_k is less than or equal to D_kD\_k. If water is given on a land, the JOI millet in that land grows, and its height is multiplied by W_kW\_k. But, the top part of length LL of the JOI millet is broken immediately, when the height becomes larger than or equal to LL. Therefore, if JOI-kun gives water to a JOI millet of height hh, the height of the JOI millet finally becomes “the remainder of h×W_kh × W\_k when divided by LL.”
  • Type 2 : JOI-kun measures the height of a JOI millet in the land X_kX\_k.

Here, the distance from the land xx (1xN1 ≤ x ≤ N) to the land yy (1yN1 ≤ y ≤ N) is the minimum number of roads we have to pass through when we move from the land xx to the land yy.

JOI-kun wants to see that the JOI millets are grown up as planned. For this purpose, he wants to calculate the height of a JOI millet measured by each action of Type 2 in advance.

Write a program which, given information of IOI Farm and JOI-kun’s plan, calculates the height of a JOI millet measured by each action of Type 2 taken by JOI-kun.

입력

Read the following data from the standard input. Given values are all integers.

\begin{align\*}& N\\,L \\\ & A\_1 \\, B\_1 \\\ & A\_2 \\, B\_2 \\\ & \vdots \\\ & A\_{N-1} \\, B\_{N-1} \\\ & H\_1 \\\ & H\_2 \\\ & \vdots \\\ & H\_N \\\ & Q \\\ & \text{(Query }1\text{)} \\\ & \text{(Query }2\text{)} \\\ & \vdots \\\ & \text{(Query }Q\text{)}  \end{align\*}

Each (Query k)\text{(Query }k\text{)} (1kQ1 ≤ k ≤ Q) consists of space separated integers. Let T_kT\_k be the first integer of (Query k)\text{(Query }k\text{)}. The content of this line is one of the following.

  • If T_k=1T\_k = 1, this line also contains three more space separated integers X_kX\_k, D_kD\_k, W_kW\_k, in this order. This means JOI-kun takes an action of Type 1 on the kk-th day, JOI-kun gives water to every land whose distance from the land X_kX\_k is less than or equal to D_kD\_k, and the height of a JOI millet is multiplied by W_kW\_k after water is given.
  • If T_k=2T\_k = 2, this line also contains one more integer X_kX\_k. This means JOI-kun takes an action of Type 2 on the k-th day, and JOI-kun measures the height of a JOI millet in the land X_kX\_k.

출력

For each action of Type 2 (i.e., for each kk (1kQ1 ≤ k ≤ Q) with T_k=2T\_k = 2), write the height of a JOI millet in the land X_kX\_k measured by the action of Type 2 on the kk-th day to the standard output, in this order. The outputs should be separated by line breaks.

제한

  • 2N200,0002 ≤ N ≤ 200\\,000.
  • 2L1,000,000,0002 ≤ L ≤ 1\\,000\\,000\\,000 (=109= 10^9).
  • 1A_i<B_iN1 ≤ A\_i < B\_i ≤ N (1iN11 ≤ i ≤ N - 1).
  • It is possible to move from any land to any other land by passing through roads.
  • 0H_jL10 ≤ H\_j ≤ L - 1 (1jN1 ≤ j ≤ N).
  • 1Q400,0001 ≤ Q ≤ 400\\,000.
  • T_kT\_k is either 11 or 22 (1kQ1 ≤ k ≤ Q).
  • For every kk (1kQ1 ≤ k ≤ Q) with T_k=1T\_k = 1, the following inequalities are satisfied: 1X_kN1 ≤ X\_k ≤ N, 0D_k400 ≤ D\_k ≤ 40, 0W_kL10 ≤ W\_k ≤ L - 1.
  • For every kk (1kQ1 ≤ k ≤ Q) with T_k=2T\_k = 2, the inequality 1X_kN1 ≤ X\_k ≤ N is satisfied.