You are given an array A of N integers. Now, you are required to process queries of the following two types.
Input format
Output format
For each query of the second type, print the answer corresponding to the query.
Constraints
1≤N,M≤105
1≤A[i],val≤1018
1≤pos≤N
For First Query :Initially the answer is 4 since 4 is the smallest index which divides the array into 2 halves having product of first part as 2*2*2*2=16 and product of second part as 2*2*2*2=16.So the value abs(16-16)=0, which is smallest possible.
Second Query : The array changes to 2 2 4 2 2 2 2 2
If we choose index 3, then the product of first part will be 2*2*4=16 and product of second part will be 2*2*2*2*2=32, the value abs(16-32)= 16 and if we choose index 4, then the product of first part will be 2*2*4*2=32 and product of second part will be 2*2*2*2=16, the value abs(32-16)= 16. Since 3 is the smaller index among 3 and 4 so answer is 3.