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,sys,bisect,heapq,os
from collections import defaultdict,Counter,deque
from itertools import groupby,accumulate
from functools import lru_cache
#sys.setrecursionlimit(200000000)
int1 = lambda x: int(x) - 1
def input(): return sys.stdin.readline().rstrip('\r\n')
#input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
aj = lambda: list(map(int, input().split()))
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
#MOD = 1000000000 + 7
def Y(c):  print(["NO","YES"][c])
def y(c):  print(["no","yes"][c])
def Yy(c):  print(["No","Yes"][c])

def solve():
	def merge(a,b):
		return min(a,b)

	def Apply(seg, d, p, v):
		seg[p] += v
		N = len(d)
		if (p < N):
			d[p] += v

	def build(seg, d, p):
		while p > 1:
			p >>= 1
			seg[p] = merge(seg[2*p],seg[2*p + 1]) + d[p]

	def push(seg,d,p):
		h = int(math.log2(len(d)))
		i = p>>h
		for s in range(h, 0, -1):
			if d[i] != 0:
				Apply(seg,d,2*i, d[i])
				Apply(seg,d,2*i + 1, d[i])
				d[i] = 0
			i //= 2


	def update(seg,d,l,r,v):
		if l > r:	return
		l += len(d)
		r += len(d)+1
		l0,r0 = l,r
		while l<r:
			if l&1:
				Apply(seg,d,l,v);l += 1
			if r&1:
				r-=1;Apply(seg,d,r,v)
			l = l//2;r = r//2
		build(seg,d,l0)
		build(seg,d,r0 - 1)

	def query(seg,d,ntrl,l,r):
		if l > r:
			return ntrl
		r+=1;l+=len(d);r+=len(d)
		push(seg,d,l);push(seg,d,r-1)
		tot = ntrl
		while l<r:
			if l&1:
				tot = merge(tot,seg[l]);l += 1
			if r&1:
				r-=1;tot = merge(tot,seg[r])
			l = l//2;r = r//2
		return tot

	def construct(A,ntrl):
		n = len(A)
		h = math.ceil(math.log2(n))
		N = 2**h
		seg = [ntrl]*(2*N)
		d = [0]*N
		for i in range(n):
			seg[N+i] = A[i]
		for i in range(n-1,0,-1):
			seg[i] = merge(seg[2*i],seg[2*i + 1])
		return seg,d


	n, = aj()
	A = aj()
	ntrl = float('inf')
	seg,d = construct(A,ntrl)
	for i in range(int(input())):
		B = aj()
		if len(B) == 2:
			l,r = B
			if l <= r:
				print(query(seg,d,ntrl,l,r))
			else:
				print(min(query(seg,d,ntrl,l,n-1),query(seg,d,ntrl,0,l)))
		else:
			l,r,v = B
			if l <= r:
				update(seg,d,l,r,v)
			else:
				update(seg,d,l,n-1,v)
				update(seg,d,0,r,v)
			


try:
	#os.system("online_judge.py")
	sys.stdin = open('input.txt', 'r') 
	sys.stdout = open('output.txt', 'w')
except:
	pass

solve()