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<iostream>
using namespace std;
const int N=2e5+5;
int f[4*N],lazy[4*N];
int a[N];
#define mid ((l+r)/2)
void pushup(int rt) {
	f[rt]=min(f[rt<<1],f[rt<<1|1]);
}
void build(int rt,int l,int r) {
	lazy[rt]=0;
	if(l==r) {
		f[rt]=a[l];
		return ;
	}
	build(rt<<1,l,mid);
	build(rt<<1|1,mid+1,r);
	pushup(rt);
}
void pushdown(int rt,int l,int r) {
	lazy[rt<<1]+=lazy[rt];
	lazy[rt<<1|1]+=lazy[rt];
	f[rt<<1]+=lazy[rt];
	f[rt<<1|1]+=lazy[rt];
	lazy[rt]=0;
}
void update(int rt,int l,int r,int ul,int ur,int val) {
	if(ul<=l&&r<=ur) {
		f[rt]+=val;
		lazy[rt]+=val;
		return ;
	}
	if(lazy!=0) {
		pushdown(rt,l,r);
	}
	if(ul<=mid) {
		update(rt<<1,l,mid,ul,ur,val);
	}
	if(mid<ur) {
		update(rt<<1|1,mid+1,r,ul,ur,val);
	}
	pushup(rt);
}
int query(int rt,int l,int r,int ql,int qr) {
	if(ql<=l&&r<=qr) {
		return f[rt];
	}
	if(lazy[rt]!=0) {
		pushdown(rt,l,r);
	}
	int ans1=0x3ffffff,ans2=0x3ffffff;
	if(ql<=mid) {
		ans1=query(rt<<1,l,mid,ql,qr);

	}
	if(mid<qr) {
		ans2=query(rt<<1|1,mid+1,r,ql,qr);
	}
	return min(ans1,ans2);
}
int main() {
	int n,m;
	cin>>n;
	for(int i=0; i<n; i++) {
		cin>>a[i];
	}
	build(1,0,n-1);
	cin>>m;
	for(int i=1; i<=m; i++) {
		int a,b,v;
		char ch;
		scanf("%d%d%c",&a,&b,&ch);
		if(ch!=' ') {
			if(a<=b) {
				cout<<query(1,0,n-1,a,b)<<endl;
			} else {
				cout<<min(query(1,0,n-1,a,n-1),query(1,0,n-1,0,b))<<endl;
			}
		} else {
			cin>>v;
			if(a<=b) {
				update(1,0,n-1,a,b,v);
			} else {
				update(1,0,n-1,a,n-1,v);
				update(1,0,n-1,0,b,v);
			}


		}
	}
	return 0;
}
		 				 						   	  	   	   	