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.
useless = input()
array = input().split(' ')
operation_amount = input()
operations = list()
for i in range(int(operation_amount)):
    operations.append(input().split(' '))
def result(operations, array):
    transformed_array = list(map(int, array))
    results = list()
    for operation in operations:
        if len(operation) == 2:
            results.append(req(operation[0], operation[1], transformed_array))
        else:
            add(operation[0], operation[1], operation[2], transformed_array)
    return results
def add(start, end, value, array):
    if start == end:
        array[int(start)] += int(value)
    elif int(start) < int(end):
        for i in range(int(start), int(end) + 1):
            array[i] += int(value)
    else:
        for i in range(int(start), len(array) + int(end) + 1):
            array[i % len(array)] += int(value)
        print(array[len(array)-int(start):int(end)],
              len(array), -len(array) + int(start), int(end))
def req(start, end, array):
    if start == end:
        return array[int(start)]
    elif int(start) < int(end):
        return min(array[int(start):int(end) + 1])
    else:
        print(array[int(end):-len(array) - int(start)],
              len(array), -len(array) + int(start), int(end))
        return min(array[i % len(array)] for i in range(int(start), len(array) + int(end) + 1))
for i in result(operations, array):
    print(i)