Universal Cup Judging System

Universal Cup

Süre Sınırı: 4.0 s Bellek Sınırı: 1024 MB Toplam puan: 100 Hack'lenebilir ✓
İstatistikler

Working in the Right Place to Ask city information desk is no easy task! As an employee, you constantly receive questions that are hardly answerable instantly.

Vasya also doesn't like answering questions. However, he likes it when computer programs do. Right now, he has an array $a$ of $n$ integers $a_1, a_2, \dots, a_n$, and he wants to write a program that can respond to the following queries:

  • 1 i val: assign the value $val$ to the element $a_i$;
  • 2 l r: calculate Vasya's sum for the numbers $a_l, a_{l+1}, \dots, a_r$.

Vasya does not consider all numbers equally good. He prefers numbers that are to the right of other numbers, and exactly twice as much! Therefore, he defines Vasya's sum for the numbers $x_1, x_2, \dots, x_k$ as the value

$$\sum_{i=1}^{k} 2^{i-1} \cdot x_i = x_1 + 2x_2 + 4x_3 + \dots + 2^{k-1}x_k.$$

Even if Vasya cannot write such a program, it's no problem: where, if not in the Right Place to Ask, can they help you calculate something in favor of the numbers on the right? So, now the burden of solving this has fallen on you! To facilitate the calculations, you only need to determine whether each Vasya's sum is positive, negative, or zero.

Input

The first line of input contains a single integer $t$ ($1 \le t \le 5 \cdot 10^5$): the number of test cases. The following $t$ descriptions of test cases are in the format described below.

The first line of a test case contains two integers $n$ and $q$ ($1 \le n, q \le 5 \cdot 10^5$): the number of integers in Vasya's array and the number of queries, respectively.

The next line contains $n$ integers $a_1, a_2, \dots, a_n$ ($-10^9 \le a_i \le 10^9$): the elements of Vasya's array in left-to-right order.

Each of the following $q$ lines describes a query either in the format 1 i val or in the format 2 L R ($1 \le i \le n$, $-10^9 \le val \le 10^9$, $1 \le L \le R \le n$). A query of the first type means that the value of the element $a_i$ must be changed to $val$. A query of the second type means that you need to find the sign of Vasya's sum for the numbers $a_L, a_{L+1}, \dots, a_R$ (exactly in that order, of course). All numbers in the queries are integers.

It is guaranteed that the sums of each of the values $n$ and $q$ across all test cases do not exceed $5 \cdot 10^5$, and that there is at least one query of the second type in each test case.

Output

For each test case, output one integer for each query of type $2$. If Vasya's sum in the given query is positive, output $1$; if negative, output $-1$; otherwise, output $0$.

Examples

Input 1

2
4 7
9 -4 2 -1
2 1 4
2 2 3
2 2 4
1 1 8
2 1 4
1 2 -5
2 1 4
7 1
2026 2 5 -14 59 59 -75
2 1 7

Output 1

1
0
-1
0
-1
-1

Note

In the first test case, Vasya's sums are $1$, $0$, $-4$, $0$, $-2$, respectively.

In the second test case, Vasya's sum is $-30$.

Note that in this problem, the input and output data can be quite large. It is recommended to use means of speeding up operations with input and output data that are available in your programming language.

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.