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<iostream>
#include<cstring>
#include<algorithm>
using namespace std;

const int N=2e5+5;
int s[N*4],lazy[N*4];

void build(int root,int left,int right){
	if(left==right){
		scanf("%d",&s[root]);
		return ;
	}
	
	int rt,mid;
	rt=root*2;
	mid=(left+right)/2;
	
	build(rt,left,mid);
	build(rt+1,mid+1,right);
	
	s[root]=min(s[rt],s[rt+1]);
}

void pushdown(int root,int left,int right){
	int rt,mid;
	rt=root*2;
	mid=(left+right)/2;
	
	lazy[rt]+=lazy[root];
	lazy[rt+1]+=lazy[root];
	s[rt]+=lazy[root];
	s[rt+1]+=lazy[root];
	lazy[root]=0;
}

void update(int root,int left,int right,int qleft,int qright,int ans){
	if(qleft<=left&&right<=qright){
		lazy[root]+=ans;
		s[root]+=ans;
		return;
	}
	
	if(lazy[root]!=0){
		pushdown(root,left,right);
	}
	
	int rt,mid;
	rt=root*2;
	mid=(left+right)/2;
	
	if(qleft<=mid){
		update(rt,left,mid,qleft,qright,ans);
	}
	if(mid<qright){
		update(rt+1,mid+1,right,qleft,qright,ans);
	} 
	
	s[root]=min(s[rt],s[rt+1]);
}

int query(int root,int left,int right,int qleft,int qright){
	if(qleft<=left&&right<=qright){
		return s[root];
	}
	
	if(lazy[root]!=0){
		pushdown(root,left,right);
	} 
	
	int rt,mid,ans;
	ans=0;
	rt=root*2;
	mid=(left+right)/2;
	
	if(qleft<=mid){
		ans=max(ans,query(rt,left,mid,qleft,qright));
	}
	if(mid<qright){
		ans=max(ans,query(rt+1,mid+1,right,qleft,qright));
	}
	
	return ans;
}

int main(){
	char ch;
	int n,m,k,lf,rg,v,ans;
	scanf("%d",&n);
	build(1,1,n);
	scanf("%d",&m);
	k=1;
	for(int i=1;i<=m;i++){
		scanf("%d%d%c",&lf,&rg,&ch);
		lf=lf+1;
		rg=rg+1;
		if(ch==' '){
			scanf("%d",&v);
			if(lf>rg){
				update(1,1,n,1,rg,v);
				update(1,1,n,lf,n,v);
			}else{
				update(1,1,n,lf,rg,v);	
			}
		}else{
			if(lf>rg){
				ans=min(query(1,1,n,1,rg),query(1,1,n,lf,n));
				printf("%d\n",ans);
			}else{
				ans=query(1,1,n,lf,rg);
				printf("%d\n",ans);	
			}
		}
	}
	return 0;
}

 		 						    		 	 		  	     	