from sortedcontainers import SortedList from atcoder.segtree import SegTree n,q,l0=map(int,input().split()) lst=SortedList(map(int,input().split())) l=[] l.append(l0) op=lambda a,b:a+b e=0 cnt=0 for _ in range(q): query=list(map(int,input().split())) if query[0]==3: que,m=query l.append(m) elif query[0]==1: que,ll=query l.append(l[-1]) lst.add(ll) else: que,left,right=query cnt+=1 st=SegTree(op,e,list(lst)) ll=lst.bisect_left(left) rr=lst.bisect_right(right) print(rr-ll,end=" ") print(st.prod(ll,rr)) if cnt==0: print("Not Found!")