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 SegmentNode:
	def __init__(self, high, low, minimum, delta):
		self.high = high
		self.low = low
		self.minimum = minimum
		self.delta = delta

	def get_true_min(self):
		return self.minimum + self.delta

class RMQSegmentTree:
	def __init__(self, size):
		self.nodes = [SegmentNode(0, 0, 0, 0) for i in range(4 * size + 1)]

		self.init_nodes(1, 0, size - 1)

	def init_nodes(self, index, left_range, right_range):
		self.nodes[index].left_range = left_range
		self.nodes[index].right_range = right_range

		if (left_range == right_range):
			return

		midpoint = (left_range + right_range) // 2
		self.init_nodes(self.get_left_child_index(index), left_range, midpoint)
		self.init_nodes(self.get_right_child_index(index), midpoint + 1, right_range)

	def increment(self, left_range, right_range, delta):
		self.increment_node(1, left_range, right_range, delta)

	def increment_node(self, index, left_range, right_range, delta):
		if self.is_no_cover(index, left_range, right_range):
			return
		elif self.is_complete_cover(index, left_range, right_range):
			self.nodes[index].delta += delta
			return
		else:
			self.propogate_delta(index)

			self.increment_node(self.get_left_child_index, left_range, right_range, delta)
			self.increment_node(self.get_right_child_index, left_range, right_range, delta)

			self.update(index)

	def minimum(self, left_range, right_range):
		return self.minimum_node(1, left_range, right_range)

	def minimum_node(self, index, left_range, right_range):
		if self.is_no_cover(index, left_range, right_range):
			return float('inf')
		elif self.is_complete_cover(index, left_range, right_range):
			return self.nodes[index].get_true_min()
		else:
			self.propogate_delta(index)

			left_child_min = self.minimum_node(self.get_left_child_index, left_range, right_range)
			right_child_min = self.minimum_node(self.get_right_child_index, left_range, right_range)

			self.update(index)
			return min(left_child_min, right_child_min)

	#helper functions
	def get_left_child_index(self, index):
		return 2 * index

	def get_right_child_index(self, index):
		return 2 * index + 1

	def is_no_cover(self, index, left_range, right_range):
		return (right_range < self.nodes[index].low or 
				self.nodes[index].high < left_range)

	def is_complete_cover(self, index, left_range, right_range):
		return (left_range <= self.nodes[index].low and 
				self.nodes[index].high <= right_range)

	def propogate_delta(self, index):
		self.nodes[self.get_right_child_index(index)].delta += self.nodes[index].delta
		self.nodes[self.get_left_child_index(index)].delta += self.nodes[index].delta
		self.nodes[index].delta = 0

	def update(self, index):
		self.nodes[index].minimum = min(self.nodes[self.get_left_child_index].get_true_min(),
										self.nodes[self.get_right_child_index].get_true_min())

class RMQCircularSegmentTree(RMQSegmentTree):
	def __init__(self, size):
		super().__init__(size)
		self.size = size

	def increment(self, left_range, right_range, delta):
		is_circular = left_range > right_range
		if (not is_circular):
			super().increment(left_range, right_range, delta)
		else:
			super().increment(left_range, self.size - 1, delta)
			super().increment(0, right_range, delta)

	def minimum(self, left_range, right_range):
		is_circular = left_range > right_range
		if (not is_circular):
			return super().minimum(left_range, right_range)
		else:
			return min(super().minimum(left_range, self.size - 1), 
					super().minimum(0, right_range))
	
def main():
	size = int(input())
	values = [int(i) for i in input().split()]

	#create the segment tree
	seg_tree = RMQCircularSegmentTree(size)
	[seg_tree.increment(i, i, values[i]) for i in range(size)]

	num_test_cases = int(input())
	for i in range(num_test_cases):
		test_values = [int(i) for i in input().split()]

		is_rmq = len(test_values) == 2
		if (is_rmq):
			print(str(seg_tree.minimum(test_values[0], test_values[1])))
		else:
			seg_tree.increment(test_values[0], test_values[1], test_values[2])


if __name__ == '__main__':
	main()

