#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long Seg[10 * 200100], Lazy[10 * 200100], a[200100];
void build(long long L, long long R, long long p) {
  if (L == R) {
    Seg[p] = a[L];
    return;
  }
  long long mid = (L + R) / 2;
  build(L, mid, p * 2);
  build(mid + 1, R, p * 2 + 1);
  Seg[p] = min(Seg[p * 2], Seg[p * 2 + 1]);
  return;
}
void pushLazy(long long p) {
  if (Lazy[p]) {
    Lazy[p * 2] += Lazy[p];
    Lazy[p * 2 + 1] += Lazy[p];
    Seg[p] += Lazy[p];
    Lazy[p] = 0;
  }
}
void update(long long L, long long R, long long l, long long r, long long p,
            long long v) {
  pushLazy(p);
  if (l > R || r < L) return;
  if (L >= l && r >= R) {
    Lazy[p] += v;
    pushLazy(p);
    return;
  }
  long long mid = (L + R) / 2;
  update(L, mid, l, r, p * 2, v);
  update(mid + 1, R, l, r, p * 2 + 1, v);
  Seg[p] = min(Seg[p * 2], Seg[p * 2 + 1]);
}
long long query(long long L, long long R, long long l, long long r,
                long long p) {
  pushLazy(p);
  if (l > R || r < L) return 1e18;
  if (L >= l && R <= r) return Seg[p];
  long long mid = (L + R) / 2;
  return min(query(L, mid, l, r, p * 2), query(mid + 1, R, l, r, p * 2 + 1));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  long long L, R;
  cin >> n;
  long long Answer;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  build(1, n, 1);
  cin >> m;
  cin.ignore();
  long long input[5];
  while (m--) {
    string line;
    getline(cin, line);
    stringstream s(line);
    long long i = 0;
    while (s >> input[i++]) L = input[0], R = input[1];
    L++;
    R++;
    if (i == 3) {
      if (L <= R)
        Answer = query(1, n, L, R, 1);
      else {
        long long Answer1 = query(1, n, L, n, 1);
        long long Answer2 = query(1, n, 1, R, 1);
        Answer = min(Answer1, Answer2);
      }
      cout << Answer << endl;
    } else {
      long long v = input[2];
      if (L <= R)
        update(1, n, L, R, 1, v);
      else {
        update(1, n, L, n, 1, v);
        update(1, n, 1, R, 1, v);
      }
    }
  }
  return 0;
}
