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.
def inc(lf,rg,v,L):
    if lf<=rg:
        for i in range(lf,rg+1):
            L[i]=L[i]+v
    else:
        for i in range(rg+1):
            L[i]=L[i]+v
        for i in range(lf,len(L)):
            L[i]=L[i]+v
    return L
    
def rmq(lf,rg,L):
    if lf<=rg:
        return int(min(i for i in L[lf:rg+1]))
    else:
        return int(min(min(i for i in L[:rg+1]),min(i for i in L[lf:])))
        
n=int(input())
S=str(input())
L=list(map(int, S.split(' ')))
m=int(input())
N=[]
for i in range(m):
    S=str(input())
    l=list(map(int, S.split(' ')))
    if len(l)==2:
        print(rmq(l[0],l[1],L))
    else:
        inc(l[0],l[1],l[2],L)