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 sys
from math import inf

class SegmentTree:
    def __init__(self, data, default=inf, func=min):
        self._default = default
        self._func = func
        self._len = len(data)
        self._size = _size = 1 << (self._len - 1).bit_length()

        self.data = [default] * (2 * _size)
        self.data[_size:_size + self._len] = data
        for i in reversed(range(_size)):
            self.data[i] = func(self.data[i + i], self.data[i + i + 1])

        self.lazy = [0] * (2 * _size)
        self._propagate = [True] * (2 * _size)

    def _gindex(self, left, right, k=1, l=0, r=None):
        if r is None:
            r = self._size
        indices = self._indices

        self._lazy_propagate_down(k, l, r)
        if left <= l and r <= right:
            return indices.append(k)

        if left < (l + r) // 2:
            self._gindex(left, right, k * 2, l, (l + r) // 2)
        if (l + r) // 2 < right:
            self._gindex(left, right, k * 2 + 1, (l + r) // 2, r)

    def _lazy_propagate_down(self, k, l, r):
        lazy = self.lazy[k]
        if lazy != 0:
            self.lazy[2 * k] += lazy
            self.lazy[2 * k + 1] += lazy
            self.data[k] += lazy
            if r - l > 1:
                self._propagate[k * 2] = self._propagate[k * 2 + 1] = False
            self.lazy[k] = 0
        self._propagate[k] = True

    def _lazy_propagate_up(self, indices):
        indices.sort(reverse=True)
        for i in indices:
            v = self._eval(i * 2) + self._eval(i * 2 + 1)
            self.data[i] = v

    def _eval(self, k):
        if self._propagate[k]:
            return self.data[k]
        return self.data[k] + self.lazy[k]

    def add(self, left, right, x):
        right = min(right, self._len)
        if right <= left:
            return
        self._gindex(left, right)
        self._lazy_propagate_up(self._indices)
        for i in self._indices:
            self.lazy[i] += x
        self._indices = []

    def query(self, left, right):
        right = min(right, self._len)
        if right <= left:
            return self._default

        self._gindex(left, right)
        self._lazy_propagate_up(self._indices)
        return min(self._eval(i) for i in self._indices)

n, *a = map(int, input().split())
tree = SegmentTree(a[:n])
res = []
append = res.append

for x in range(0, len(a) - n, 3):
    if a[n + x] == 0:
        tree.add(a[n + x + 1] - 1, a[n + x + 2], a[n + x + 3])
    else:
        append(tree.query(a[n + x + 1] - 1, a[n + x + 2]))

sys.stdout.buffer.write('\n'.join(map(str, res)).encode())