#include <bits/stdc++.h>
using namespace std;
const long long INFll = 1ll * 1000000100 * 1000000100;
const long double PI =
    3.141592653589793238462643383279502884197169399375105820974944;
void constructST(long long st[], int a[], int si, int l, int r) {
  if (l == r)
    st[si] = a[l];
  else {
    int mid = ((l) + (r)) / 2;
    constructST(st, a, 2 * (si) + 1, l, mid);
    constructST(st, a, 2 * (si) + 2, mid + 1, r);
    st[si] = min(st[2 * (si) + 1], st[2 * (si) + 2]);
  }
}
void UpdateUtil(long long st[], long long lazy[], int si, int l, int r, int ql,
                int qr, long long diff) {
  if (lazy[si] != 0) {
    st[si] += lazy[si];
    if (l != r) {
      lazy[2 * (si) + 1] += lazy[si];
      lazy[2 * (si) + 2] += lazy[si];
    }
    lazy[si] = 0;
  }
  if (l > r || ql > r || l > qr) return;
  if (ql <= l && qr >= r) {
    st[si] += diff;
    if (l != r) {
      lazy[2 * (si) + 1] += diff;
      lazy[2 * (si) + 2] += diff;
    }
    return;
  }
  int mid = ((l) + (r)) / 2;
  UpdateUtil(st, lazy, 2 * (si) + 1, l, mid, ql, qr, diff);
  UpdateUtil(st, lazy, 2 * (si) + 2, mid + 1, r, ql, qr, diff);
  st[si] = min(st[2 * (si) + 1], st[2 * (si) + 2]);
}
void update(long long st[], long long lazy[], int n, int ql, int qr,
            long long diff) {
  UpdateUtil(st, lazy, 0, 0, n - 1, ql, qr, diff);
}
long long queryUtil(long long st[], long long lazy[], int si, int l, int r,
                    int ql, int qr) {
  if (lazy[si] != 0) {
    st[si] += lazy[si];
    if (l != r) {
      lazy[2 * (si) + 1] += lazy[si];
      lazy[2 * (si) + 2] += lazy[si];
    }
    lazy[si] = 0;
  }
  if (l > r || ql > r || l > qr)
    return INFll;
  else if (l >= ql && r <= qr)
    return st[si];
  int mid = ((l) + (r)) / 2;
  long long p1 = queryUtil(st, lazy, 2 * (si) + 1, l, mid, ql, qr);
  long long p2 = queryUtil(st, lazy, 2 * (si) + 2, mid + 1, r, ql, qr);
  return min(p1, p2);
}
long long query(long long st[], long long lazy[], int n, int ql, int qr) {
  return queryUtil(st, lazy, 0, 0, n - 1, ql, qr);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int a[n + 10];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long st[4 * n + 5], lazy[4 * n + 5];
  for (int i = 0; i < 4 * n + 5; i++) lazy[i] = 0;
  constructST(st, a, 0, 0, n - 1);
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> ws;
    int cnt = -1;
    int a, b;
    long long c;
    string str;
    getline(std::cin, str);
    for (int i = 0; i < str.length(); i++)
      if (str[i] == ' ') cnt++;
    stringstream s(str);
    if (cnt == 1) {
      s >> a >> b >> c;
      if (a <= b) {
        update(st, lazy, n, a, b, c);
      } else {
        update(st, lazy, n, a, n - 1, c);
        update(st, lazy, n, 0, b, c);
      }
    } else {
      s >> a >> b;
      if (a <= b)
        cout << query(st, lazy, n, a, b) << endl;
      else
        cout << min(query(st, lazy, n, a, n - 1), query(st, lazy, n, 0, b))
             << endl;
    }
  }
}
