#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  long long fh = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= fh;
}
template <typename T>
void write(T x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
void writeln(T x) {
  write(x);
  puts("");
}
long long n, m;
long long a[200005];
long long mn[1600005], tag[1600005];
void pushup(long long p) { mn[p] = min(mn[(p << 1)], mn[(p << 1 | 1)]); }
void build(long long p, long long l, long long r) {
  tag[p] = 0;
  if (l == r) {
    mn[p] = a[l];
    return;
  }
  long long mid = l + r >> 1;
  build((p << 1), l, mid);
  build((p << 1 | 1), mid + 1, r);
  pushup(p);
}
void f(long long p, long long l, long long r, long long k) {
  tag[p] += k;
  mn[p] += k;
}
void pushdown(long long p, long long l, long long r) {
  long long mid = l + r >> 1;
  f((p << 1), l, mid, tag[p]);
  f((p << 1 | 1), mid + 1, r, tag[p]);
  tag[p] = 0;
}
void modify(long long p, long long l, long long r, long long ll, long long rr,
            long long k) {
  if (ll <= l && rr >= r) {
    tag[p] += k;
    mn[p] += k;
    return;
  }
  pushdown(p, l, r);
  long long mid = l + r >> 1;
  if (ll <= mid) modify((p << 1), l, mid, ll, rr, k);
  if (rr > mid) modify((p << 1 | 1), mid + 1, r, ll, rr, k);
  pushup(p);
}
long long query(long long p, long long l, long long r, long long ll,
                long long rr) {
  long long res = 100000000000000007;
  if (ll <= l && rr >= r) {
    return mn[p];
  }
  pushdown(p, l, r);
  long long mid = l + r >> 1;
  if (ll <= mid) res = min(res, query((p << 1), l, mid, ll, rr));
  if (rr > mid) res = min(res, query((p << 1 | 1), mid + 1, r, ll, rr));
  return res;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  build(1, 1, n);
  cin >> m;
  cin.get();
  for (long long i = 1; i <= m; i++) {
    string str;
    getline(cin, str);
    stringstream ss;
    ss << str;
    vector<long long> vec;
    long long tmp;
    while (ss >> tmp) vec.push_back(tmp);
    if (vec.size() == 3) {
      vec[0]++;
      vec[1]++;
      if (vec[0] <= vec[1])
        modify(1, 1, n, vec[0], vec[1], vec[2]);
      else {
        modify(1, 1, n, vec[0], n, vec[2]);
        modify(1, 1, n, 1, vec[1], vec[2]);
      }
    } else {
      long long ans = 100000000000000007;
      vec[0]++;
      vec[1]++;
      if (vec[0] <= vec[1])
        ans = min(ans, query(1, 1, n, vec[0], vec[1]));
      else {
        ans = min(ans, query(1, 1, n, vec[0], n));
        ans = min(ans, query(1, 1, n, 1, vec[1]));
      }
      cout << ans << endl;
    }
  }
  return 0;
}
