#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const long long MAX = 2e5 + 5;
const long long INF = 1e18;
long long n, a[MAX], m, t[MAX << 2], lazy[MAX << 2];
void build(long long v, long long l, long long r) {
  if (l == r) {
    t[v] = a[l];
    return;
  }
  long long m = (l + r) >> 1;
  build(v << 1, l, m);
  build(v << 1 | 1, m + 1, r);
  t[v] = min(t[v << 1], t[v << 1 | 1]);
}
void push(long long v) {
  lazy[v << 1] += lazy[v];
  lazy[v << 1 | 1] += lazy[v];
  lazy[v] = 0;
}
void increase(long long v) {
  t[v] = min(t[v << 1] + lazy[v << 1], t[v << 1 | 1] + lazy[v << 1 | 1]);
}
void update(long long v, long long l, long long r, long long u_l, long long u_r,
            long long val) {
  if (l > u_r || r < u_l) return;
  if (u_l <= l && r <= u_r) {
    lazy[v] += val;
    return;
  }
  push(v);
  long long m = (l + r) >> 1;
  update(v << 1, l, m, u_l, u_r, val);
  update(v << 1 | 1, m + 1, r, u_l, u_r, val);
  increase(v);
}
long long query(long long v, long long l, long long r, long long q_l,
                long long q_r) {
  if (l > q_r || r < q_l) return INF;
  if (q_l <= l && r <= q_r) {
    return t[v] + lazy[v];
  }
  long long m = (l + r) >> 1;
  push(v);
  long long p = query(v << 1, l, m, q_l, q_r);
  long long q = query(v << 1 | 1, m + 1, r, q_l, q_r);
  increase(v);
  return min(p, q);
}
signed main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  build(1, 1, n);
  long long m;
  cin >> m;
  string p;
  getline(cin, p);
  while (m--) {
    string s;
    getline(cin, s);
    stringstream stream(s);
    vector<long long> inp;
    string word;
    while (stream >> word) {
      long long x = stoll(word);
      inp.push_back(x);
    }
    long long l = inp[0];
    long long r = inp[1];
    if ((long long)inp.size() == 2) {
      l++;
      r++;
      if (l <= r)
        cout << query(1, 1, n, l, r) << "\n";
      else {
        cout << min(query(1, 1, n, l, n), query(1, 1, n, 1, r)) << "\n";
      }
      continue;
    } else {
      long long v = inp[2];
      l++;
      r++;
      if (l <= r)
        update(1, 1, n, l, r, v);
      else {
        update(1, 1, n, l, n, v);
        update(1, 1, n, 1, r, v);
      }
    }
  }
  return 0;
}
