Codeforces Round 356 (Div. 1)
E
Bear and Bad Powers of 42
Codeforces
3100
原题
← D→
翻译中…

Limak, a bear, isn't good at handling queries. So, he asks you to do it.

翻译中…

We say that powers of $42$ (numbers $1, 42, 1764, ...$) are bad. Other numbers are good.

翻译中…

You are given a sequence of $*n*$ good integers $*t*_{1}, *t*_{2}, ..., *t*_{*n*}$. Your task is to handle $*q*$ queries of three types:

翻译中…
  1. 1 i — print $*t*_{*i*}$ in a separate line.
  2. 2 a b x — for image set $*t*_{*i*}$ to $*x*$. It's guaranteed that $*x*$ is a good number.
  3. 3 a b x — for image increase $*t*_{*i*}$ by $*x*$. After this repeat the process while at least one $*t*_{*i*}$ is bad.
翻译中…

You can note that after each query all $*t*_{*i*}$ are good.

翻译中…

Input

翻译中…

The first line of the input contains two integers $*n*$ and $*q*$ ($1 ≤ *n*, *q* ≤ 100 000$) — the size of Limak's sequence and the number of queries, respectively.

翻译中…

The second line of the input contains $*n*$ integers $*t*_{1}, *t*_{2}, ..., *t*_{*n*}$ ($2 ≤ *t*_{*i*} ≤ 10^{9}$) — initial elements of Limak's sequence. All $*t*_{*i*}$ are good.

翻译中…

Then, $*q*$ lines follow. The $*i*$-th of them describes the $*i*$-th query. The first number in the line is an integer $*type*_{*i*}$ ($1 ≤ *type*_{*i*} ≤ 3$) — the type of the query. There is at least one query of the first type, so the output won't be empty.

翻译中…

In queries of the second and the third type there is $1 ≤ *a* ≤ *b* ≤ *n*$.

翻译中…

In queries of the second type an integer $*x*$ ($2 ≤ *x* ≤ 10^{9}$) is guaranteed to be good.

翻译中…

In queries of the third type an integer $*x*$ ($1 ≤ *x* ≤ 10^{9}$) may be bad.

翻译中…

Output

翻译中…

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

翻译中…

Note

翻译中…

After a query 3 2 4 42 the sequence is $40, 1742, 49, 1714, 4, 1722$.

翻译中…

After a query 3 2 6 50 the sequence is $40, 1842, 149, 1814, 104, 1822$.

翻译中…

After a query 2 3 4 41 the sequence is $40, 1842, 41, 41, 104, 1822$.

翻译中…

After a query 3 1 5 1 the sequence is $43, 1845, 44, 44, 107, 1822$.

翻译中…

样例

Input #1
6 12
40 1700 7 1672 4 1722
3 2 4 42
1 2
1 3
3 2 6 50
1 2
1 4
1 6
2 3 4 41
3 1 5 1
1 1
1 3
1 5
Output #1
1742
49
1842
1814
1822
43
44
107
InputCopy OutputCopy
题目信息
题号
679E
时间限制
5 s
内存限制
256 MB
标签
数据结构

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。