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())

def inc(lf,r,v):
    global l
    global n
    if r<lf:
        r=n+r
    while lf!=r+1:
        l[lf]+=v
        lf+=1
def rmq(lf,r):
    global l
    global n
    new=list()
    if r<lf:
        r=n+r
    for i in range(lf,r+1):
        new.append(l[i])
    a=min(new)
    print(a)
def circular(n):
    b = [None] * 2 * n
    a=list()
    line=input().split()
    for i in range(n):
        a.append(int(line[i]))

    i = 0
    while i < n:
        b[i] = b[n + i] = a[i]
        i = i + 1

    return b
l=circular(n)

m=int(input())
for i in range(m):
    line=input().split()
    if len(line)==2:
        rmq(int(line[0]),int(line[1]))
    elif len(line)==3:
        inc(int(line[0]),int(line[1]),int(line[2]))
