#include <bits/stdc++.h>
using namespace std;
template <class T>
void show(T a, int n) {
  for (int i = 0; i < n; ++i) cout << a[i] << ' ';
  cout << endl;
}
template <class T>
void show(T a, int r, int l) {
  for (int i = 0; i < r; ++i) show(a[i], l);
  cout << endl;
}
const int N = 210000;
const int M = 500;
const long long oo = (long long)10000000000000000LL;
int n, m;
int tn;
int val[N];
long long a[M][M];
int sz[M];
long long add[M];
long long minv[M];
void addv(int lf, int rf, int v) {
  int i, j;
  int li = lf / m;
  int lj = lf % m;
  int ri = rf / m;
  int rj = rf % m;
  for (j = lj; j < sz[li]; ++j) {
    if (li == ri && j > rj) break;
    a[li][j] += v;
  }
  minv[li] = oo;
  for (j = 0; j < sz[li]; ++j)
    minv[li] = (minv[li] < a[li][j] ? minv[li] : a[li][j]);
  if (li == ri) return;
  for (j = 0; j <= rj; ++j) {
    a[ri][j] += v;
  }
  minv[ri] = oo;
  for (j = 0; j < sz[ri]; ++j)
    minv[ri] = (minv[ri] < a[ri][j] ? minv[ri] : a[ri][j]);
  for (i = li + 1; i < ri; ++i) {
    add[i] += v;
  }
}
long long query(int lf, int rf) {
  int i, j;
  int li = lf / m;
  int lj = lf % m;
  int ri = rf / m;
  int rj = rf % m;
  long long ans = oo;
  for (j = lj; j < sz[li]; ++j) {
    if (li == ri && j > rj) return ans;
    ans = (ans < a[li][j] + add[li] ? ans : a[li][j] + add[li]);
  }
  if (li == ri) return ans;
  for (j = 0; j <= rj; ++j)
    ans = (ans < a[ri][j] + add[ri] ? ans : a[ri][j] + add[ri]);
  for (i = li + 1; i < ri; ++i) {
    ans = (ans < minv[i] + add[i] ? ans : minv[i] + add[i]);
  }
  return ans;
}
char buf[100];
int main() {
  int i, j, cas = 0;
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%d", &val[i]);
  }
  memset(sz, 0, sizeof(sz));
  m = int(sqrt(n));
  for (tn = 0, i = 0; i < n; ++i) {
    if (sz[tn] == m) ++tn;
    a[tn][sz[tn]++] = val[i];
  }
  ++tn;
  for (i = 0; i < tn; ++i) {
    add[i] = 0;
    minv[i] = a[i][0];
    for (j = 0; j < sz[i]; ++j)
      minv[i] = (minv[i] < a[i][j] ? minv[i] : a[i][j]);
  }
  int q;
  scanf("%d", &q);
  gets(buf);
  while (q--) {
    gets(buf);
    int lf, ri, v;
    stringstream in(buf);
    in >> lf >> ri;
    if (in >> v) {
      if (lf <= ri)
        addv(lf, ri, v);
      else {
        addv(lf, n - 1, v);
        addv(0, ri, v);
      }
    } else {
      long long ans = oo;
      if (lf <= ri) {
        ans = query(lf, ri);
      } else {
        long long t1 = query(lf, n - 1);
        long long t2 = query(0, ri);
        ans = (t1 < t2 ? t1 : t2);
      }
      printf("%I64d\n", ans);
    }
  }
  return 0;
}
