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<stdio.h>
#include<string.h>
#include<cmath>
#include<iostream>
using namespace std;
const int N=1e6+5;
const int INF = 0x3fff;
int m[N*4],lazy[N*4];

void pushdown(int root){
	int rt = root*2;
	if(lazy[root]){
		lazy[rt] +=lazy[root];
		lazy[rt+1] += lazy[root];
		m[rt] += lazy[root];
		m[rt+1] += lazy[root];
	}
	
}

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

void update(int root,int l,int r,int ql,int qr,int val){
	
	if(ql<=l&&qr>=r){
		m[root] +=val;
		lazy[root] +=val;
		return;
	}
	
	pushdown(root);
	
	int mid = (l+r)/2;
	int rt = root*2;
	
	if(ql<=mid){
		update(rt,l,mid,ql,qr,val);
	}
	if(qr>mid){
		update(rt+1,mid+1,r,ql,qr,val);
	}
	
	m[root] = min(m[rt],m[rt+1]);
	
}

int query(int root,int l,int r,int ql,int qr){
	
	if(ql<=l&&qr>=r){
		return m[root];
	}
	
	pushdown(root);
	
	int mid = (l+r)/2;
	int rt = root*2;
	int ans=INF;
	
	if(ql<=mid){
		ans = min(ans,query(rt,l,mid,ql,qr));
	}
	if(qr>mid){
		ans = min(ans,query(rt+1,mid+1,r,ql,qr));
	}
	
	return ans;
}

int main(){
	int n;
	scanf("%d",&n);
	build(1,1,n);
	memset(lazy,0,sizeof(lazy));
	
	int m;
	scanf("%d",&m);
	
	int a,b,v;
	char c;
	while(m--){
		scanf("%d%d",&a,&b);
		scanf("%c",&c);
		a++;
		b++;
		if(c!='\n'){
			scanf("%d",&v);
			
			if(a>b){
				update(1,1,n,a,n,v);
				update(1,1,n,1,b,v);
			}
			update(1,1,n,a,b,v);
			
		}else{
			
			int ans = INF;
			if(a>b){
				ans = min(query(1,1,n,a,n),ans);
				
				ans = min(query(1,1,n,1,b),ans);
			}else{
				ans = query(1,1,n,a,b);
			}
			printf("%d\n",ans);
		}
		
	}
	
	return 0;
}

 		 	 	 		  			  	 		  			 	 	