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 constructST(arr, n):
    st = [1e9 for node in range(2*n)]

    for i in range(n):
        st[n+i] = arr[i]

    for i in range(n-1, 0, -1):
        st[i] = min(st[2 * i], st[2 * i + 1])

    return st

def updateValue(st, n, i, new_val):
    i += n

    st[i] = new_val

    while i > 1:
        i >>= 1

        st[i] = min(st[2 * i], st[2 * i + 1])

    return st

def INC(st, n, lf, rg, v):
    if lf <= rg:
        for i in range(lf, rg+1):
            st = updateValue(st, n, i, st[n+i]+v)
    else:
        for i in range(lf, n):
            st = updateValue(st, n, i, st[n+i]+v)
        for i in range(0, rg+1):
            st = updateValue(st, n, i, st[n+i]+v)

    return st

def RMQUtil(st, n, lf, rg):
    if lf == rg:
        return st[lf+n]

    else:
        lf += n
        rg += n

        mi = 1e9

        while lf < rg:
            if lf%2 != 0:
                mi = min(mi, st[lf])
                lf += 1

            if rg%2 != 0:
                rg -= 1

                mi = min(mi, st[rg])

            lf //= 2
            rg //= 2

        return mi

def RMQ(st, n, lf, rg):
    if lf <= rg:
        return RMQUtil(st, n, lf, rg)
    else:
        return min(RMQUtil(st, n, lf, n-1), RMQUtil(st, n, 0, rg))


n = int(input())
arr = list(map(int, input().split(' ')))
m = int(input())

st = constructST(arr, n)
#st_aux = constructST([0 for i in range(n)], n)

for op in range(m):
    ops = list(map(int, input().split(' ')))
    if len(ops) == 2:
        lf, rg = ops
        print(RMQ(st, n, lf, rg))
    else:
        lf, rg, v = ops
        st = INC(st, n, lf, rg, v)
