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.
N = int(input())
tree = [200001] * (2 * N) 

def build(arr) :  
    for i in range(N) : 
        tree[N + i] = int(arr[i])
    for i in range(N - 1, 0, -1) : 
        tree[i] = tree[i << 1] if tree[i << 1] < tree[i << 1 | 1] else tree[i << 1 | 1] 
  
def updateTreeNode(p, value):
    tree[p + N] = tree[p + N] + value 
    p = p + N 
    i = p
    while i > 1 :
        tree[i >> 1] = tree[i] if tree[i] < tree[i ^ 1] else tree[i ^ i]
        i >>= 1 
  
def queryInc(l, r, v) : 
    #l += N
    #r += N

    if (r < l):
        s1 = 0
        e1 = r+1
        s2 = l
        e2 = N-1
        while s1 < e1 :
            if (s1 & 1) :
                updateTreeNode(s1, v)
                s1 += 1
            if (e1 & 1) :
                e1 -= 1
                updateTreeNode(e1, v)
            s1 >>= 1
            e1 >>= 1
        while s2 < e2 :
            if (s2 & 1) :
                updateTreeNode(s2, v)
                s2 += 1
            if (e2 & 1) :
                e2 -= 1
                updateTreeNode(e2, v)
            s2 >>= 1
            e2 >>= 1
        
    else:
        while l < r :
            if (l & 1) :
                updateTreeNode(l, v)
                l += 1
            if (r & 1) :
                r -= 1
                updateTreeNode(r, v)
            l >>= 1
            r >>= 1
  
def queryRMQ(l, r) : 

    l += N
    r += N
    if (r < l):
        min_value1 = 200001
        min_value2 = 200001
        s1 = 0
        e1 = r+1
        s2 = l
        e2 = N
        # print("debug")
        while s1 < e1 :
            if (s1 & 1) :
                min_value1 = tree[s1] if tree[s1] < min_value1 else min_value1
                s1 += 1
            if (e1 & 1) :
                e1 -= 1
                min_value1 = tree[e1] if tree[e1] < min_value1 else min_value1

            s1 >>= 1
            e1 >>= 1
        while s2 < e2 :
            if (s2 & 1) :
                min_value2 = tree[s2] if tree[s2] < min_value2 else min_value2
                s2 += 1
            if (e2 & 1) :
                e2 -= 1
                min_value2 = tree[e2] if tree[e2] < min_value2 else min_value2

            s2 >>= 1
            e2 >>= 1
        return str(min_value1) if min_value1 < min_value2 else str(min_value2)

    else:
        min_value = 200001
        while l < r :
            if (l & 1) :
                min_value = tree[l] if tree[l] < min_value else min_value
                l += 1
            if (r & 1) :
                r -= 1
                min_value = tree[r] if tree[r] < min_value else min_value

            l >>= 1
            r >>= 1
        return str(min_value)

if __name__ == "__main__" : 
    operations = []
    value = input()
    a = value.split(" ")
    #print("contendido de a: " + a[0]+"-"+a[1]+"-"+a[2]+"-"+a[3])
    build(a)
    m = int(input())
    results = []
    for i in range(m):
        operator = input()
        operation = operator.split(" ")
        # print(f'El largo de operation es: {len(operation)}')
        if len(operation) == 2:
            results.append(queryRMQ(int(operation[0]), int(operation[1])))
        else:
            queryInc(int(operation[0]), int(operation[1]), int(operation[2]))

    for i in results:
        print(i)