#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T Abs(T a) {
  return a > 0 ? a : -a;
}
vector<long long> t;
vector<long long> add;
int n;
const long long Inf = (long long)1e18;
void build(vector<long long> &a, int i = 0, int l = 0, int r = n - 1) {
  if (i == 0) {
    t.resize(4 * n);
    add.resize(4 * n);
  }
  if (l == r) {
    t[i] = a[l];
  } else {
    int m = (l + r) / 2;
    build(a, 2 * i + 1, l, m);
    build(a, 2 * i + 2, m + 1, r);
    t[i] = min(t[2 * i + 1], t[2 * i + 2]);
  }
}
void inc(int a, int l, int r, int i = 0, int tl = 0, int tr = n - 1) {
  if (tl >= l && tr <= r) {
    add[i] += a;
    return;
  }
  if (min(r, tr) < max(l, tl)) return;
  int m = (tr + tl) / 2;
  inc(a, l, r, 2 * i + 1, tl, m);
  inc(a, l, r, 2 * i + 2, m + 1, tr);
  t[i] = min(t[2 * i + 1] + add[2 * i + 1], t[2 * i + 2] + add[2 * i + 2]);
}
long long get(int l, int r, int i = 0, int tl = 0, int tr = n - 1) {
  if (min(r, tr) < max(l, tl)) return Inf;
  if (tl >= l && tr <= r) {
    return t[i] + add[i];
  }
  int m = (tl + tr) / 2;
  return add[i] +
         min(get(l, r, 2 * i + 1, tl, m), get(l, r, 2 * i + 2, m + 1, tr));
}
char s[1000];
int main() {
  scanf("%d", &n);
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &a[i]);
  }
  build(a);
  int m;
  scanf("%d\n", &m);
  for (int i = 0; i < m; i++) {
    gets(s);
    int l, r, v;
    if (sscanf(s, "%d%d%d", &l, &r, &v) == 3) {
      if (l > r) {
        inc(v, 0, r);
        inc(v, l, n - 1);
      } else {
        inc(v, l, r);
      }
    } else {
      if (l > r)
        cout << min(get(0, r), get(l, n - 1)) << endl;
      else
        cout << get(l, r) << endl;
    }
  }
  return 0;
}
