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.
#First try with lazy propagation
import sys
sys.setrecursionlimit(10**9)
input=sys.stdin.readline
n=int(input())
a=[int(x) for x in input().split()]
m=int(input())
seg=[0 for i in range(4*n)]
lazy=[0 for i in range(4*n)]
def create(seg,s,e,v,a):
    if s>e:
        return
    if s==e:
        seg[v]=a[s]
    else:
        mid=(s+e)//2
        create(seg,s,mid,2*v+1,a)
        create(seg,mid+1,e,2*v+2,a)
        seg[v]=seg[2*v+1]+seg[2*v+2]
def update(seg,s,e,v,qs,qe,val,lazy):
    if s>qe or e<qs or s>e:
        return 999999999999999
    if s==qs and e==qe:
        seg[v]+=val
        if s!=e:
            lazy[2*v+1]+=val
            lazy[2*v+2]+=val
        return seg[v]    
    else:
        mid=(s+e)//2
        seg[v]=min(update(seg,s,mid,2*v+1,qs,qe,val,lazy),\
        update(seg,mid+1,e,2*v+2,qs,qe,val,lazy))
        return seg[v]
def query(seg,s,e,qs,qe,lazy,v):
    if s>qe or e<qs or s>e:
        return 999999999999999999
    if lazy[v]!=0:
        seg[v]+=lazy[v]
        if s!=e:
            lazy[2*v+1]+=lazy[v]
            lazy[2*v+2]+=lazy[v]
        lazy[v]=0    
    if s==qs and e==qe:
        return seg[v]
    else:
        mid=(s+e)//2
        seg[v]=min(query(seg,s,mid,qs,qe,lazy,2*v+1),\
        query(seg,mid+1,e,qs,qe,lazy,2*v+2))
        return seg[v]
create(seg,0,n-1,1,a)
for i in range(m):
    p=[int(x) for x in input().split()]
    if len(p)==2:
        if p[0]>p[1]:
            u=query(seg,0,n-1,p[0],n-1,lazy,1)
            v=query(seg,0,n-1,0,p[1],lazy,1)
            print(min(u,v))
        else:
            u=query(seg,0,n-1,p[0],p[1],lazy,1)
            print(u)
    elif len(p)==3:
        if p[0]>p[1]:
            update(seg,0,n-1,1,p[0],n-1,p[2],lazy)
            update(seg,0,n-1,1,0,p[1],p[2],lazy)
        else:
            update(seg,0,n-1,1,p[0],p[1],p[2],lazy)        
            