#include <bits/stdc++.h>
using namespace std;
struct node {
  long long l, r, mini, incre;
} T[1000000];
long long A[200005];
long long N, M;
long long L, R, V;
long long build(long long k, long long L, long long R) {
  long long mid;
  T[k].l = L;
  T[k].r = R;
  T[k].incre = 0;
  if (L == R) {
    T[k].mini = A[L];
    return 0;
  }
  mid = (L + R) / 2;
  build((long long)k * 2, (long long)L, (long long)mid);
  build((long long)k * 2 + 1, (long long)mid + 1, (long long)R);
  T[k].mini = min(T[k * 2].mini + T[k * 2].incre,
                  T[k * 2 + 1].mini + T[k * 2 + 1].incre);
  return 0;
}
long long query(long long k, long long L, long long R) {
  long long mid, lret, rret;
  if (T[k].l >= L && T[k].r <= R) {
    return T[k].mini + T[k].incre;
  }
  if (T[k].l > R || T[k].r < L) {
    return 50000000000000;
  }
  mid = (T[k].l + T[k].r) / 2;
  lret = query(k * 2, L, R);
  rret = query(k * 2 + 1, L, R);
  return min(lret, rret) + T[k].incre;
}
long long increment(long long k, long long L, long long R, long long V) {
  long long mid;
  if (T[k].l >= L && T[k].r <= R) {
    T[k].incre += V;
    return 0;
  }
  if (T[k].l > R || T[k].r < L) {
    return 0;
  }
  mid = (T[k].l + T[k].r) / 2;
  increment(k * 2, L, R, V);
  increment(k * 2 + 1, L, R, V);
  T[k].mini = min(T[k * 2].mini + T[k * 2].incre,
                  T[k * 2 + 1].mini + T[k * 2 + 1].incre);
  return 0;
}
int main() {
  int i, c;
  long long lret, rret;
  scanf("%lld", &N);
  for (i = 1; i <= N; i++) scanf("%lld", &A[i]);
  build((long long)1, (long long)1, (long long)N);
  scanf("%lld", &M);
  for (i = 1; i <= M; i++) {
    scanf("%lld %lld", &L, &R);
    L++;
    R++;
    c = getchar();
    if (c == '\n') {
      if (L <= R) {
        printf("%lld\n", query((long long)1, (long long)L, (long long)R));
      } else {
        lret = query((long long)1, (long long)1, (long long)R);
        rret = query((long long)1, (long long)L, (long long)N);
        printf("%lld\n", min(lret, rret));
      }
    } else {
      scanf("%lld", &V);
      if (L <= R) {
        increment((long long)1, (long long)L, (long long)R, (long long)V);
      } else {
        increment((long long)1, (long long)1, (long long)R, (long long)V);
        increment((long long)1, (long long)L, (long long)N, (long long)V);
      }
    }
  }
  return 0;
}
