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.
#pragma GCC optimize(2)
#include<bits/stdc++.h> 
using namespace std;
#define ll long long
#define endl "\n"
const int MAX=200005;
struct node
{
	ll lz;//lazy标记
	ll mn;//最小值min
}d[MAX<<2];
ll n,m,x;
void push_up(int p)
{
	d[p].mn=min(d[2*p].mn,d[2*p+1].mn);
}
void push_down(int s,int t,int mid,int p)
{
	if(d[p].lz==0)return ;
		d[2*p].lz+=d[p].lz;
		d[2*p].mn+=d[p].lz;	
		d[2*p+1].lz+=d[p].lz;
		d[2*p+1].mn+=d[p].lz;
		d[p].lz=0;	
}
void build(int s,int t,int p)
{
	d[p].lz=0;
	if(s==t){
		cin>>d[p].mn;
		return;
	}
	int mid=(s+t)/2;
	build(s,mid,2*p);
	build(mid+1,t,2*p+1);
	push_up(p);
}

void update(int l,int r,int c,int s,int t,int p)  
{
	if(l<=s&&t<=r)
	{
		d[p].lz+=c;
		d[p].mn+=c;
		return ;
	}
	int mid=(s+t)/2;
	push_down(s,t,mid,p);
	if(l<=mid)update(l,r,c,s,mid,2*p);
	if(r>mid)update(l,r,c,mid+1,t,2*p+1);
	push_up(p);
}
void update(int l,int r,int c)
{
	update(l,r,c,1,n,1);
}

ll getmin(int l,int r,int s,int t,int p){

	if(l<=s&&t<=r){
		return d[p].mn;
	}
	int mid=(s+t)/2;
	push_down(s,t,mid,p);
	ll ans=INT_MAX;
	if(l<=mid)ans=min(ans,getmin(l,r,s,mid,2*p));
	if(r>mid)ans=min(ans,getmin(l,r,mid+1,t,2*p+1));
	return ans;
}
ll getmin(int l,int r)
{
	return getmin(l,r,1,n,1);
}
int main(){
    
	cin>>n;
	build(1,n,1);
	ll a = INT_MAX , b = INT_MAX , v = INT_MAX;
	
	cin>>m;
	while(m--)
	{
		cin>>a>>b;
		a++,b++;
		char c=getchar();
		if(c!='\n'){
			cin>>v;
           		if(a <= b)update(a,b,v);
                else{
                        update(a,n,v);
                        update(1,b,v);
                }
        }
		else{
        	if(a <= b)cout<<getmin(a,b);
        	else cout<<min(getmin(1,b),getmin(a,n));
        
		}
	}
   return 0;
} 

 			   			  		  	  			 	 	 		 	