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 <bits/stdc++.h>
using namespace std;

typedef long long int ll;
const int maxn=200000;
int lo[4*maxn+2];
int hi[4*maxn+2];
int val[4*maxn+2];
ll minv[4*maxn+2];
int a[maxn+2];

void update(int node)
{
    minv[node]=min(minv[2*node]+val[2*node], minv[2*node+1]+val[2*node+1]);
}

void push(int node)
{
    val[2*node]+=val[node];
    val[2*node+1]+=val[node];
    val[node]=0;
}

void build(int node,int l,int r)
{
    lo[node]=l;
    hi[node]=r;
    if(l==r)
    {
        minv[node]=a[l];
        return;
    }
    int mid=(l+r)/2;
    build(2*node,l,mid);
    build(2*node+1,mid+1,r);
    update(node);
}

void inc(int node,int l,int r,int v)
{
    if(r<lo[node] || hi[node]<l)
        return;
    if(l<=lo[node] && hi[node]<=r)
    {
        val[node]+=v;
        return;
    }
    push(node);
    inc(2*node,l,r,v);
    inc(2*node+1,l,r,v);
    update(node);
}

ll rmq(int node,int l,int r)
{
    if(r<lo[node] || hi[node]<l)
        return (ll)1e9;
    if(l<=lo[node] && hi[node]<=r)
        return minv[node]+val[node];
    push(node);
    ll minl=rmq(2*node,l,r);
    ll minr=rmq(2*node+1,l,r);
    update(node);
    return min(minl, minr);
}

int main()
{
    int n,m;
    cin>>n;
    for(int i=0;i<n;i++) cin>>a[i];
    build(1,0,n-1);
    cin>>m;
    while(m--)
    {
        int l,r,v;
        cin>>l>>r;
        if(cin.peek()!='\n')
        {
            cin>>v;
            if(r<l) inc(1,l,n-1,v), inc(1,0,r,v);
            else inc(1,l,r,v);
        }
        else
        {
            if(r<l) cout<<min(rmq(1,l,n-1), rmq(1,0,r));
            else cout<<rmq(1,l,r);
            cout<<endl;
        }
    }
    return 0;
}