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())
a = list(map(int, input().split()))

t = [0] * 4 * n
d = [0] * 4 * n


def apply(v, x):
    t[v] += x
    d[v] += x


def push(v):
    if d[v]:
        apply(2 * v + 1, d[v])
        apply(2 * v + 2, d[v])
        d[v] = 0


def pull(v):
    t[v] = min(t[2 * v + 1], t[2 * v + 2])


def build(v=0, l=0, r=n):
    if (r - l == 1):
        t[v] = a[l]
        d[v] = 0
    else:
        m = (l + r) // 2
        build(2 * v + 1, l, m)
        build(2 * v + 2, m, r)
        pull(v)


def upd(v, l, r, x, tl=0, tr=n):
    if r <= tl or tr <= l:
        return
    elif l <= tl and tr <= r:
        apply(v, x)
    else:
        push(v)
        tm = (tl + tr) // 2
        upd(2 * v + 1, l, r, x, tl, tm)
        upd(2 * v + 2, l, r, x, tm, tr)
        pull(v)


def get(v, l, r, tl=0, tr=n):
    if r <= tl or tr <= l:
        return 10 ** 18
    elif l <= tl and tr <= r:
        return t[v]
    else:
        push(v)
        tm = (tl + tr) // 2
        return min(get(2 * v + 1, l, r, tl, tm),
                   get(2 * v + 2, l, r, tm, tr))


build()
for _ in range(int(input())):
    inp = list(map(int, input().split()))
    if len(inp) == 2:
        l, r = inp
        if l <= r:
            print(get(0, l, r + 1))
        else:
            print(min(get(0, 0, r + 1), get(0, l, n)))
    else:
        l, r, v = inp
        if l <= r:
            upd(0, l, r + 1, v)
        else:
            upd(0, 0, r + 1, v)
            upd(0, l, n, v)
