#include using namespace std; template struct segment_tree{ vector tree; int depth; function comp; T unit; segment_tree(vector& a,function f,T unit=0){ this->unit=unit; comp=f; depth=(int)ceil(log(a.size())/log(2))+1; tree.resize((1<=0;--i){ tree[i]=comp(tree[i*2+1],tree[i*2+2]); } } void update(int index,T value){ index+=(1<<(depth-1))-1; tree[index]=value; while(index!=0){ index=(index-1)/2; tree[index]=comp(tree[index*2+1],tree[index*2+2]); } } T get(int begin,int end){ T ret=unit; begin+=(1<<(depth-1))-1; end+=(1<<(depth-1))-1; while(begin>N>>Q>>S; vector array(N-1,0); segment_tree T(array,[](int a,int b){return a+b;},0); for(int i=0;i>q; if(q==1){ cin>>q; S[q-1]=(S[q-1]=='('?')':'('); for(int i=max(0,q-2);i>l>>r; cout<