import sys input = sys.stdin.readline N,Q=list(map(int,input().split())) A=list(map(int,input().split())) sq=int(N**(1/2)) LEN=(N+sq-1)//sq lastLEN=N%sq UNIT=[-1]*LEN SUM=[0]*LEN for i in range(LEN): LIST=[] for j in range(i*sq,min(N,i*sq+sq)): LIST.append(A[j]) SUM[i]+=A[j] #print(LIST) if len(set(LIST))==1: UNIT[i]=LIST[0] for tests in range(Q): #print(A) L=list(map(int,input().split())) if L[0]==0: l,r=L[1],L[2] ANS=0 now=l while now