QOJ.ac

QOJ

Límite de tiempo: 2 s Límite de memoria: 512 MB Puntuación total: 100

#11062. TEST_69

Estadísticas

Given a sequence $a$ of length $n$, there are $m$ operations.

There are two types of operations:

1 l r x: For all $i$ in the range $[l, r]$, replace $a_i$ with $\gcd(a_i, x)$.

2 l r: Query the sum of the range $[l, r]$, outputting the answer modulo $2^{32}$.

Input

The first line contains two integers $n$ and $m$.

The second line contains $n$ integers representing $a_i$.

The following $m$ lines each contain three or four integers, representing an operation.

Output

For each type $2$ operation, output one integer per line representing the answer to the query.

Examples

Input 1

10 10
4 1 5 10 1 3 8 2 8 2  
2 1 7
2 1 10
1 7 10 4
1 5 8 10
2 1 8
1 3 5 2
1 3 4 3
2 5 8
2 3 7
2 6 10

Output 1

32
44
26
6
6
11

Subtasks

Idea: nzhtl1477, Solution: nhtl1477, Code: ccz181078, Data: ccz181078

For $20\%$ of the data, $1 \le n, m, a_i, x \le 10^3$.

For $50\%$ of the data, $1 \le n, m \le 10^5$, and the elements of $a$ and the $x$ in each operation are generated randomly.

For another $20\%$ of the data, all queries occur after all modifications.

For $100\%$ of the data, $1 \le n \le 2 \cdot 10^5$, $1 \le m \le 5 \cdot 10^5$, and all values are integers in the range $[1, 10^{18}]$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.