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.
st = [0] * 800005
lz = [0] * 800005

n = int(input())

def appNode(l, r, x, v):
    st[v] += x
    lz[v] += x

def pushNode(l, m, r, v):
    appNode(l, m, lz[v], v << 1)
    appNode(m + 1, r, lz[v], v << 1 | 1)
    lz[v] = 0

def updateSt(a, b, x, l, r, v):
    if a > b:
        updateSt(0, b, x, l, r, v)
        updateSt(a, n - 1, x, l, r, v)
    elif a <= l and r <= b:
        appNode(l, r, x, v)
    elif (b >= l) and (r >= a):
        m = (l + r) >> 1
        pushNode(l, m, r, v)
        updateSt(a, b, x, l, m, v << 1)
        updateSt(a, b, x, m + 1, r, v << 1 | 1)
        st[v] = min(st[v << 1], st[v << 1 | 1])
    
def minSt(a, b, l, r, v):
    if a > b:
        return min(minSt(0, b, l, r, v), minSt(a, n - 1, l, r, v))
    if a <= l and r <= b:
        return st[v]
    if b < l or r < a:
        return 2000000000
    m = (l + r) >> 1
    pushNode(l, m, r, v)
    return min(minSt(a, b, l, m, v << 1), minSt(a, b, m + 1, r, v << 1 | 1))

a = list(map(int, input().split()))
for i in range(n):
    b = a[i]
    updateSt(i, i, b, 0, n - 1, 1)

q = int(input())
for i in range(n):
    op = list(map(int, input().split()))
    if(len(op) == 2):
        print(minSt(op[0], op[1], 0, n - 1, 1))
    else:
        updateSt(op[0], op[1], op[2], 0, n - 1, 1)