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.
class TreeNode(object):
    def __init__(self):
        self.left=-1
        self.right=-1
        self.sum_num=0
        self.lazy_tag=0
    def __str__(self):
        return '[%s,%s,%s,%s]' % (self.left,self.right,self.sum_num,self.lazy_tag)
    def __repr__(self):
        return '[%s,%s,%s,%s]' % (self.left,self.right,self.sum_num,self.lazy_tag)
class Tree(object):
    def __init__(self, n, arr):
        self.n = n
        self.max_size = 4 * n
        self.tree = [TreeNode() for i in range(self.max_size)]
        self.arr = arr
    def _build(self, index, left, right):
        self.tree[index].left = left
        self.tree[index].right = right
        if left == right:
            self.tree[index].sum_num = self.arr[left - 1]
        else:
            mid = (left + right) // 2
            self._build(index * 2, left, mid)
            self._build(index * 2 + 1, mid + 1, right)
            self.pushup_sum(index)
    def build(self):
        self._build(1, 1, self.n)
    def _update2(self, ql, qr, val, i, l, r, ):
        mid = (l + r) // 2
        if l >= ql and r <= qr:
            self.tree[i].sum_num += val
            self.tree[i].lazy_tag += val
        else:
            self.pushdown_sum(i)
            if mid >= ql:
                self._update2(ql, qr, val, i * 2, l, mid)
            if qr > mid:
                self._update2(ql, qr, val, i * 2 + 1, mid + 1, r)
            self.pushup_sum(i)
    def update2(self, ql, qr, val, ):
        self._update2(ql, qr, val, 1, 1, self.n)
    def _query2(self, ql, qr, i, l, r, ):
        if l >= ql and r <= qr:
            return self.tree[i].sum_num
        else:
            self.pushdown_sum(i)
            mid = (l + r) // 2
            res_l = float("Inf")
            res_r = float("Inf")
            if ql <= mid:
                res_l = self._query2(ql, qr, i * 2, l, mid, )
            if qr > mid:
                res_r = self._query2(ql, qr, i * 2 + 1, mid + 1, r, )
            return min(res_l , res_r)
    def query2(self, ql, qr):
        return self._query2(ql, qr, 1, 1, self.n)
    def pushup_sum(self, k):
        self.tree[k].sum_num = min(self.tree[k * 2].sum_num ,self.tree[k * 2 + 1].sum_num)
    def pushdown_sum(self, i):
        lazy_tag = self.tree[i].lazy_tag
        if lazy_tag != 0:
            self.tree[i * 2].lazy_tag += lazy_tag
            self.tree[i * 2].sum_num += lazy_tag
            self.tree[i * 2 + 1].lazy_tag += lazy_tag
            self.tree[i * 2].sum_num += lazy_tag
            self.tree[i].lazy_tag = 0
    def _show_arr(self, i):
        if self.tree[i].left == self.tree[i].right and self.tree[i].left != -1:
            print(self.tree[i].sun_num, end=" ")
        if 2 * i < len(self.tree):
            self._show_arr(i * 2)
            self._show_arr(i * 2 + 1)
    def show_arr(self, ):
        self._show_arr(1)
    def __str__(self):
        return str(self.tree)
n=int(input())
arr=[int(i) for i in input().split()]
tree=Tree(n,arr)
tree.build()
m=int(input())
for i in range(m):
    B=[int(i) for i in input().split()]
    if len(B)==3:
        if B[0]<=B[1]:
            tree.update2(B[0]+1,B[1]+1,B[2])
        else:
            tree.update2(B[0] + 1, n, B[2])
            tree.update2(1, B[1] + 1, B[2])
    if len(B)==2:
        if B[0]<=B[1]:
            print(tree.query2(B[0]+1,B[1]+1))
        else:
            print(min(tree.query2(B[0]+1,n),tree.query2(1,B[1]+1)))