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 Node:
	def __init__(self, left, right, x):
		self.range = (left, right)
		self.value, self.lazy = x, 0
		self.left, self.right = None, None
	
	def update_value(self):
		self.value = min(self.left.value, self.right.value)
		return self
	
	def propagate(self):
		self.value += self.lazy
		if self.left is not None:
			self.left.lazy += self.lazy
			self.right.lazy += self.lazy
		self.lazy = 0

class SegmentTree:
	def __init__(self, arr):
		self.root = self.__constructTree(arr, 0, len(arr) - 1)
	
	def __constructTree(self, arr, left, right):
		if left > right: return None
		if left == right: return Node(left, right, arr[left])

		new_node = Node(left, right, float("inf"))
		new_node.left = self.__constructTree(arr, left, (left + right) // 2 + 0)
		new_node.right = self.__constructTree(arr, (left + right) // 2 + 1, right)
		new_node.update_value()
		return new_node
	
	def __update(self, start, end, value, node):
		node.propagate()
		if node.range[1] < start or end < node.range[0]: return

		if start <= node.range[0] and node.range[1] <= end:
			node.lazy += value
			node.propagate()
			return
		
		self.__update(start, end, value, node.left)
		self.__update(start, end, value, node.right)
		return node.update_value()
	
	def __get_range_min(self, start, end, node):
		node.propagate()
		if node.range[1] < start or end < node.range[0]: return float("inf")

		if start <= node.range[0] and node.range[1] <= end: return node.value
		
		p1 = self.__get_range_min(start, end, node.left)
		p2 = self.__get_range_min(start, end, node.right)
		return min(p1, p2)
	
	def update(self, start, end, value): self.__update(start, end, value, self.root)
	def get_range_min(self, start, end): return self.__get_range_min(start, end, self.root)

n = int(input())
segtree = SegmentTree(list(map(int, input().split())))

m = int(input())
for _ in range(m):
	tokens = tuple(map(int, input().split()))
	if len(tokens) == 2:
		left, right = tokens
		if left <= right: print(segtree.get_range_min(left, right))
		else: print(min(segtree.get_range_min(left, n-1), segtree.get_range_min(0, right)))
	if len(tokens) == 3:
		left, right, value = tokens
		if left <= right: segtree.update(left, right, value)
		else:
			segtree.update(left, n-1, value)
			segtree.update(0, right, value)