Joy of computer scientist#7840

Joy of computer scientist

1 second
122.174 megabytes
Easy

This year pupils participate at Informatics Olympiad. The participants are numbered from to .

With the new system, they see their points immediately after sending a solution to the task. From the result of the test, the mood of the participant can change very much. At the very beginning of the Olympics, the mood of all participants equals to one.

There is a history of changes in the mood of participants. The jury wants to control the mood of all participants, and asks you for help.

You have the queries of three types:

0 L R P - Jury wants to know the product of the mood of all the participants, numbered from to . This number can be big, so print it modulo ;

1 L R X - All participants with numbers from to learned the result of checking and the mood of each one is multiplied by the number ;

2 L R X - All participants with numbers from to , learned the result of checking and the mood of each one is divided by the number . It is guaranteed that the mood of each participant on this segment is divisible by .

Input

First line contains numbers and , the number of participants and number of queries. Next lines describe the queries. It is known that in all queries 1 \leq L \leq R \leq n, 1 \leq X \leq 100, 1 \leq P \leq 10^9, 1 \leq n, m \leq 50000.

Output

For each query of type 0 print the answer in a separate line.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading