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.
/*
 * @Description: 
 * @Author: Glimmer_Y
 * @Date: 2022-07-14 17:54:15
 * @LastEditors: Glimmer_Y
 * @LastEditTime: 2022-07-14 20:00:46
 */
#include <iostream>
using namespace std;
const int N = 2e5+5;
typedef long long ll;
ll f[N<<2];
ll lazy[N<<2];
void pushdown(int root, int left, int right)
{
    int mid = (left + right) >> 1;
    int rt = root << 1;
    f[rt] += lazy[root];
    f[rt+1] += lazy[root];
    lazy[rt] += lazy[root];
    lazy[rt+1] += lazy[root];
    lazy[root] = 0; 
}
void build(int root, int left, int right)
{
    lazy[root] = 0;
    if(left == right){
        scanf("%lld", &f[root]); 
        return;
    }
    int mid = (left + right) >> 1;
    int rt = root << 1;
    build(rt, left, mid);
    build(rt+1, mid+1, right);
    f[root] = min(f[rt], f[rt+1]);
}
void update(int root, int val, int left, int right, int qleft, int qright)
{
    if(qleft<=left && right<=qright)
    {
        f[root] += val;
        lazy[root] += val;
        return ;
    }
    if(lazy[root]!=0){
        pushdown(root, left, right);
    }
    int mid = (left + right) >> 1;
    int rt = root << 1;
    if(qleft <= mid) update(rt, val, left, mid, qleft, qright);
    if(qright > mid) update(rt+1, val, mid+1, right, qleft, qright);
    f[root] = min(f[rt], f[rt+1]);
}
ll query(int root, int left, int right, int qleft, int qright)
{
    if(qleft<=left && right<=qright){
        return f[root];
    }
    if(lazy[root]!=0){
        pushdown(root, left, right);
    }
    int mid = (left + right) >> 1;
    int rt = root << 1;
    ll res = 0x3f3f3f;
    if(qleft <= mid) res = min(res, query(rt, left, mid, qleft, qright));
    if(qright > mid) res = min(res, query(rt+1, mid+1, right, qleft, qright));
    return res;
}
int main(){
    int n, m, l, r, v;
    char ch;
    scanf("%d", &n);
    build(1, 1, n);
    scanf("%d", &m);
    for(int i=1; i<=m; i++){
        scanf("%d%d%c", &l, &r, &ch);
        if(ch == ' '){
            scanf("%d", &v);
            if(l > r){
                update(1, v, 1, n, 1, r+1);
                update(1, v, 1, n, l+1, r+1);
            }else{
                update(1, v, 1, n, l+1, r+1);
            }
        }else{
            if(l > r){
                printf("%lld\n", min(query(1, 1, n, 1, r+1), query(1, 1, n, l+1, n)));
            }else{
                printf("%lld\n", query(1, 1, n, l+1, r+1));
            }
        }
    }
    return 0;
}
   		 	       			 	  	 			    	