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 inp():
    return map(int, input().split())
INF = int(1e12)
maxn = 200000 * 4
it = [0] * maxn 
lazy = [0] * maxn

def updateLazy(l, r, i):
    if lazy[i] > 0:
        it[i] += lazy[i]
        if l < r:
            lazy[i << 1] += lazy[i]
            lazy[i << 1 | 1] += lazy[i]
        lazy[i] = 0
def update(u, v, w, l, r, i):
    updateLazy(l, r, i)
    if r < u or v < l:
        return 
    if u <= l and r <= v:
        it[i] += w
        if l < r:
            lazy[i << 1] += w
            lazy[i << 1 | 1] += w
        return
    mid = (l + r) >> 1
    update(u, v, w, l, mid, i << 1)
    update(u, v, w, mid + 1, r , i << 1 | 1)
    it[i] = min(it[i << 1], it[i << 1 | 1])
    

def find(u, v, l, r, i):
    updateLazy(l, r, i)
    if r < u or v < l:
        return INF
    if u <= l and r <= v:
        return it[i]
    mid = (l + r) >> 1
    left = find(u, v, l, mid, i << 1)
    right = find(u, v, mid + 1, r , i << 1 | 1)
    it[i] = min(it[i << 1], it[i << 1 | 1])
    return min(left, right)

n  = int(input())
arr = list(inp())
q = int(input())

for i in range(n):
    update(i + 1, i + 1, arr[i], 1, n, 1)
for _ in range(q):
    arr_qq = list(inp())
    l, r = arr_qq[0], arr_qq[1]
    l += 1
    r += 1
    if len(arr_qq) == 2:
        if l <= r:
            print(find(l, r, 1, n, 1))
        else:
            print(min(find(l, n, 1, n, 1), find(1, r, 1, n, 1)))
    else:
        w = arr_qq[2]
        if l <= r:
            update(l, r, w, 1, n, 1)
        else:
            update(l, n, w, 1, n, 1)
            update(1, r, w, 1, n, 1)