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.
import math
inf = math.inf

class LazySegmentTree:
    def __init__(self, arr):
        self.arr = arr
        self.tree = [inf] * (4 * len(arr))
        self.lazy = [0] * (4 * len(arr))
        self.build(1, 0, len(arr) - 1)

    def build(self, node, start, end):
        if start == end:
            self.tree[node] = self.arr[start]
        else:
            mid = (start + end) // 2
            self.build(2 * node, start, mid)
            self.build(2 * node + 1, mid + 1, end)
            self.tree[node] = min(self.tree[2 * node], self.tree[2 * node + 1])

    def update_range(self, node, start, end, l, r, value):
        if self.lazy[node] != 0:
            self.tree[node] += self.lazy[node]
            if start != end:
                self.lazy[2 * node] += self.lazy[node]
                self.lazy[2 * node + 1] += self.lazy[node]
            self.lazy[node] = 0

        if start > end or start > r or end < l:
            return

        if start >= l and end <= r:
            self.tree[node] += value
            if start != end:
                self.lazy[2 * node] += value
                self.lazy[2 * node + 1] += value
            return

        mid = (start + end) // 2
        self.update_range(2 * node, start, mid, l, r, value)
        self.update_range(2 * node + 1, mid + 1, end, l, r, value)
        self.tree[node] = min(self.tree[2 * node],self.tree[2 * node + 1])

    def query_range(self, node, start, end, l, r):
        if start > end or start > r or end < l:
            return inf

        if self.lazy[node] != 0:
            self.tree[node] += self.lazy[node]
            if start != end:
                self.lazy[2 * node] += self.lazy[node]
                self.lazy[2 * node + 1] += self.lazy[node]
            self.lazy[node] = 0

        if start >= l and end <= r:
            return self.tree[node]

        mid = (start + end) // 2
        left_min = self.query_range(2 * node, start, mid, l, r)
        right_min = self.query_range(2 * node + 1, mid + 1, end, l, r)
        return min(left_min,right_min)

    def update(self, left,right, value):
        self.update_range(1, 0, len(self.arr) - 1, left, right, value)

    def query(self, left, right):
        return self.query_range(1, 0, len(self.arr) - 1, left, right)

n = int(input())
arr = list(map(int, input().split()))
seg = LazySegmentTree(arr)
q = int(input())
for _ in range(q):
    query = list(map(int, input().split()))
    if len(query) == 2:
        l, r = query
        if l <= r:
            print(seg.query(l, r))
        else:
            a = seg.query(0, r)
            b = seg.query(l, n-1)
            print(min(a,b))
    else:
        l, r, v = query
        if l <= r:
            seg.update(l, r, v)
        else:
            seg.update(0, r, v)
            seg.update(l, n-1, v)