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
input = lambda: sys.stdin.readline().rstrip("\r\n")
fast_print = lambda p: sys.stdout.write(str(p) + "\n") 

from math import inf

def make_segment_tree(arr):
  N = len(arr)
  tree = [inf] * (4*N) # use-case
  lazy = [0] * (4*N)
  build(tree, arr)
  return tree, lazy

def build(tree, arr):
  q = [(1, 1, 0, len(arr)-1)]
  while q:
    a, v, tl,tr = q.pop()
    if a == 1:
      if tl == tr:
        tree[v] = arr[tl]
      else:
        tm = (tl + tr) // 2
        q.append((2, v, tl, tr))
        q.append((1, v*2, tl, tm))
        q.append((1, v*2+1, tm+1, tr))
    else:
      tree[v] = min(tree[v*2], tree[v*2+1])

def push(tree, lazy, vertex):
  tree[2 * vertex] += lazy[vertex]
  lazy[2*vertex] += lazy[vertex]

  tree[2 * vertex + 1] += lazy[vertex]
  lazy[2*vertex+1] += lazy[vertex]
  
  lazy[vertex] = 0

def range_update(tree, lazy, l, r, val):
  q = [(1, 1, 0, len(tree)//4-1, l, r)]
  while q:
    a, v, tl, tr, l, r = q.pop()
    if a == 1:
      if l > r:
        continue
      if tl == l and tr == r:
        tree[v] += val
        lazy[v] += val
      else:
        push(tree, lazy, v)
        tm = (tl + tr) // 2
        q.append((2, v, tl, tr, l, r))
        q.append((1, v*2, tl, tm, l, min(r, tm)))
        q.append((1, v*2+1, tm+1, tr, max(l, tm+1), r))
    else:
      tree[v] = min(tree[v*2], tree[v*2+1])

def range_query(tree, lazy, l, r):
  q = [(1, 1, 0, len(tree)//4 - 1, l, r)]
  res = []
  while q:
    a, v, tl, tr, l, r = q.pop()
    if a == 1:
      if l > r:
        res.append(inf)
        continue
      if l == tl and tr == r:
        res.append(tree[v])
        continue
      push(tree, lazy, v)
      tm = (tl + tr) // 2
      q.append((2, v, tl, tr, l, r))
      q.append((1, v*2, tl, tm, l, min(tm, r)))
      q.append((1, v*2+1, tm+1, tr, max(l, tm+1), r))
    else:
      res.append(min(res.pop(), res.pop()))
  return res[0]

n = int(input())
a = list(map(int,sys.stdin.readline().split()))
m = int(input())

# print(f"n = {n}, a = {a}, m = {m}")

tree, lazy = make_segment_tree(a)

def circular_range_update(l,r,val):
  # print(f"CRU called with l = {l}, r = {r}, v = {v}")
  if l <= r:
    range_update(tree, lazy, l, r, val)
  else:
    # print(f"circular query: calling {(l, n-1)} and {(0, r)}")
    range_update(tree, lazy, l, n-1, val)
    range_update(tree, lazy, 0, r, val)

def circular_range_query(l, r):
  if l <= r:
    return range_query(tree, lazy, l, r)
  else:
    return min(
      range_query(tree, lazy, l, n-1),
      range_query(tree, lazy, 0, r),
    )

for _ in range(m):
  op_args = list(map(int,sys.stdin.readline().split()))
  if len(op_args) == 3:
    circular_range_update(op_args[0], op_args[1], op_args[2])
    # print(f"result tree = {tree}")
    # print(f"result lazy = {lazy}")
  else:
    fast_print(circular_range_query(op_args[0], op_args[1]))