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.
import copy
lazy = [0 for n in range(400004)]
mini = copy.deepcopy(lazy)

def propagate (node) :
    for i in range(2) :
        lazy[2*node+i+1] += lazy[node]
        mini[2*node+i+1] += lazy[node]
        
    lazy[node] = 0

def update (node, l, r, a, b, val) :
    #print(node, l, r, a, b, val)

    if (l > b or r < a) : return
    if (l >= a and r <= b) :        
        lazy[node] += val
        mini[node] += val
        return
        
    propagate(node)
    
    mid = l + r >> 1
    update(2*node+1, l, mid+0, a, b, val)
    update(2*node+2, mid+1, r, a, b, val)
    mini[node] = min(mini[2*node+1], mini[2*node+2])
    
def query (node, l, r, a, b) :
    if (l > b or r < a) : return 2000000000
    if (l >= a and r <= b) : return mini[node]
    
    propagate(node)
    
    mid = l + r >> 1
    return min( query(2*node+1, l, mid, a, b),  query(2*node+1, mid+1, r, a, b) )
    
n = int(input())
ls = list(map(int, input().split()))
for i in range(n) : update(0, 0, n-1, i, i, ls[i])
#for i in range(n) : print(query(0, 0, n-1, i, i))

m = int(input())
for que in range(m) :
    q = list(map(int, input().split()))
    if (len(q) == 2) : 
        if (q[0] <= q[1]) : print(query(0, 0, n-1, q[0], q[1]))
        else : print( min( query(0, 0, n-1, q[0], n-1), query(0, 0, n-1, 0, q[1]) ) )
    else :
        if (q[0] <= q[1]) : update(0, 0, n-1, q[0], q[1], q[2])
        else :
            update(0, 0, n-1, q[0], n-1, q[2])
            update(0, 0, n-1, 0, q[1], q[2])
            