You are given circular array *a*<sub class="lower-index">0</sub>, *a*<sub class="lower-index">1</sub>, ..., *a*<sub class="lower-index">*n* - 1</sub>. There are two types of operations with it: 
 -  *inc*(*lf*, *rg*, *v*) — this operation increases each element on the segment [*lf*, *rg*] (inclusively) by *v*; -  *rmq*(*lf*, *rg*) — this operation returns minimal value on the segment [*lf*, *rg*] (inclusively). 
Assume segments to be circular, so if *n* = 5 and *lf* = 3, *rg* = 1, it means the index sequence: 3, 4, 0, 1.

Write program to process given sequence of operations.
The first line contains integer *n* (1 ≤ *n* ≤ 200000). The next line contains initial state of the array: *a*<sub class="lower-index">0</sub>, *a*<sub class="lower-index">1</sub>, ..., *a*<sub class="lower-index">*n* - 1</sub> ( - 10<sup class="upper-index">6</sup> ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">6</sup>), *a*<sub class="lower-index">*i*</sub> are integer. The third line contains integer *m* (0 ≤ *m* ≤ 200000), *m* — the number of operartons. Next *m* lines contain one operation each. If line contains two integer *lf*, *rg* (0 ≤ *lf*, *rg* ≤ *n* - 1) it means *rmq* operation, it contains three integers *lf*, *rg*, *v* (0 ≤ *lf*, *rg* ≤ *n* - 1; - 10<sup class="upper-index">6</sup> ≤ *v* ≤ 10<sup class="upper-index">6</sup>) — *inc* operation.
#include<cstdio>
#include<cstring>
#include<algorithm>
#define mid ((left+right)>>1) 
#define rt (root<<1)
using namespace std;
 
const int N=2e5+5;
typedef long long ll;
ll mi[N<<2],lazy[N<<2];


void pushup(int root){
	mi[root]=min(mi[rt],mi[rt+1]);
}
void build(int root,int left,int right){
	
	lazy[root]=0;
	if(left==right){
		scanf("%lld",&mi[root]);
		return;
	}
	build(rt,left,mid);
	build(rt+1,mid+1,right);
	
	pushup(root);
}

void pushdown(int root,int left,int right){
	
	lazy[rt]+=lazy[root];
	lazy[rt+1]+=lazy[root];//懒标记下放 
	
	mi[rt]+=lazy[root];
	mi[rt+1]+=lazy[root];//根节点最小值更新 
	lazy[root]=0;
}
void update(int root,int left,int right,int uleft,int uright,int val){

	if(uleft>right||uright<left)return;//剪枝 
	
	if(uleft<=left&&right<=uright){
		mi[root]+=val;
		lazy[root]+=val;
		return;
	}
	
	if(lazy[root]){
		pushdown(root,left,right);
	}

	if(uleft<=mid){
		update(rt,left,mid,uleft,uright,val);
	}if(uright>mid){
		update(rt+1,mid+1,right,uleft,uright,val);
	}
	
	pushup(root);
}

ll query(int root,int left,int right,int qleft,int qright){
	if(qleft<=left&&right<=qright){
		return mi[root];
	}
	if(lazy[root]){
		pushdown(root,left,right);
	}
	ll ans = N<<2;
	if(qleft<=mid){
		ans=min(ans,query(rt,left,mid,qleft,qright));
	}if(qright>mid){
		ans=min(ans,query(rt+1,mid+1,right,qleft,qright));
	}
	
	return ans;
}

void print(int root,int left,int right){
	if(left==right){
		printf("%d ",mi[root]);
		return;
	}
	if(lazy[root])pushdown(root,left,right);
	print(rt,left,mid);
	print(rt+1,mid+1,right);
	
	
} 

int main(){
	int n1,n2,k1,k2;
	char ch;
	ll c;
	scanf("%d",&n1);
	build(1,1,n1);
	scanf("%d",&n2);
	while(n2--){
		scanf("%d%d%c",&k1,&k2,&ch);
		if(ch==' '){
			scanf("%lld",&c);//区间加 
			if(k1>k2){
				update(1,1,n1,k1+1,n1,c);
				update(1,1,n1,1,k2+1,c);
			}else{
				update(1,1,n1,k1+1,k2+1,c);
			}
		}else{//区间最小 
	//	printf("          %d %d\n",k1,k2);
			if(k1>k2){//环 
				printf("%lld\n",min(query(1,1,n1,k1+1,n1),query(1,1,n1,1,k2+1)));
			}else{
				printf("%lld\n",query(1,1,n1,k1+1,k2+1));
			} 
		
		}
	}
}
 		  		  	 			 	 		 			 	    	