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 SegmentTreeMin:
    def __init__(self, l):
        self.N = 1

        while self.N < len(l):
            self.N *= 2

        self.segmentTree = [float("inf") for _ in range(2 * self.N)]

        for i in range(len(l)):
            self.segmentTree[self.N + i] = l[i]

        for j in range(self.N - 1, 0, -1):
            self.segmentTree[j] = min(self.segmentTree[2 * j], self.segmentTree[2 * j + 1])

    def value(self, i):
        return self.segmentTree[self.N + i]

    def update(self, i, value):
        self.segmentTree[self.N + i] = value
        p = self.N + i

        while p > 1:
            p //= 2
            self.segmentTree[p] = min(self.segmentTree[2 * p], self.segmentTree[2 * p + 1])

    def rmq(self, i, k):
        if i <= k:
            return self.rmq_rec(1, 0, self.N, i, k + 1)
        else:
            return min(
                self.rmq_rec(1, 0, self.N, 0, k + 1),
                self.rmq_rec(1, 0, self.N, i, self.N)
            )

    def rmq_rec(self, p, start, span, i, k):
        if start + span <= i or k <= start:
            return float("inf")
        elif i <= start and start + span <= k:
            # print(p, self.segmentTree[p])
            return self.segmentTree[p]
        else:
            return min(
                self.rmq_rec(2 * p, start, span // 2, i, k),
                self.rmq_rec(2 * p + 1, start + span // 2, span // 2, i, k)
            )

    def inc(self, lf, rg, v):
        if lf <= rg:
            self.inc_rec(1, 0, self.N, lf, rg + 1, v)
        else:
            self.inc(lf, self.N, v)
            self.inc(0, rg + 1, v)

    def inc_rec(self, p, start, span, lf, rg, v):
        if start + span <= lf or rg <= start:
            pass
        else:
            if 2 * p + 1 < 2 * self.N + 1:
                self.inc_rec(2 * p, start, span // 2, lf, rg, v)
                self.inc_rec(2 * p + 1, start + span // 2, span // 2, lf, rg, v)
                self.segmentTree[p] = min(self.segmentTree[2 * p], self.segmentTree[2 * p + 1])
            else:
                self.segmentTree[p] += v

if __name__ == '__main__':
    n = int(input())
    l = list(map(int, input().split(" ")))
    m = int(input())

    s = SegmentTreeMin(l)

    for _ in range(m):
        operation = list(map(int, input().split(" ")))
        if len(operation) == 2:
            # print(s.segmentTree)
            print(s.rmq(*operation))
        else:
            s.inc(*operation)
