#include <bits/stdc++.h>
using namespace std;
struct segtree {
  vector<long long> st, lazy;
  int n;
  long long neutro = 0, oo = 1e18;
  segtree(const vector<long long> &v) {
    n = v.size();
    st.assign(n * 4, 0);
    lazy.assign(n * 4, neutro);
    build(1, 0, n - 1, v);
  }
  void build(int p, int L, int R, const vector<long long> &v) {
    if (L == R)
      st[p] = v[L];
    else {
      int m = (L + R) / 2, l = p * 2, r = l + 1;
      build(l, L, m, v);
      build(r, m + 1, R, v);
      st[p] = min(st[l], st[r]);
    }
  }
  void propagate(int p, int L, int R, long long val) {
    if (val == neutro) return;
    st[p] += val;
    lazy[p] = neutro;
    if (L == R) return;
    int l = p * 2, r = l + 1;
    lazy[l] += val;
    lazy[r] += val;
  }
  long long query(int p, int L, int R, int i, int j) {
    propagate(p, L, R, lazy[p]);
    if (i > R || j < L) return oo;
    if (i <= L && R <= j) return st[p];
    int m = (L + R) / 2, l = p * 2, r = l + 1;
    long long lf = query(l, L, m, i, j);
    long long rg = query(r, m + 1, R, i, j);
    return min(lf, rg);
  }
  void upd(int p, int L, int R, int i, int j, long long val) {
    propagate(p, L, R, lazy[p]);
    if (i > R || j < L) return;
    if (i <= L && R <= j)
      propagate(p, L, R, val);
    else {
      int m = (L + R) / 2, l = p * 2, r = l + 1;
      upd(l, L, m, i, j, val);
      upd(r, m + 1, R, i, j, val);
      st[p] = min(st[l], st[r]);
    }
  }
  long long query(int i, int j) { return query(1, 0, n - 1, i, j); }
  void upd(int i, int j, long long val) { upd(1, 0, n - 1, i, j, val); }
};
vector<string> split(const string &s) {
  vector<string> v;
  stringstream ss(s);
  string sub;
  while (ss >> sub) v.push_back(sub);
  return v;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int n, m, a, b;
  long long c, q;
  vector<string> aux;
  string s;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  segtree sgt(v);
  cin >> m;
  cin.ignore();
  for (int i = 0; i < m; i++) {
    getline(cin, s);
    aux = split(s);
    if (aux.size() == 2) {
      a = atoi(aux[0].data()), b = atoi(aux[1].data());
      if (a <= b)
        q = sgt.query(a, b);
      else
        q = min(sgt.query(0, b), sgt.query(a, n - 1));
      cout << q << '\n';
    } else {
      a = atoi(aux[0].data()), b = atoi(aux[1].data()),
      c = atoll(aux[2].data());
      if (a <= b)
        sgt.upd(a, b, c);
      else {
        sgt.upd(0, b, c);
        sgt.upd(a, n - 1, c);
      }
    }
  }
  return 0;
}
