#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2 * 100 * 1000 + 17, inf = 1e17 + 17;
struct node {
  long long mn, lazy;
  node() {
    mn = 0;
    lazy = 0;
  }
  void add(long long val) {
    mn += val;
    lazy += val;
  }
  node operator+(const node &x) const {
    node res;
    res.mn = min(mn, x.mn);
    return res;
  }
};
int n, a[MAXN], q;
node seg[4 * MAXN];
void add(int lp, int rp, long long val, int v = 1, int l = 0, int r = n) {
  if (rp <= l || r <= lp) return;
  if (lp <= l && r <= rp) {
    seg[v].add(val);
    return;
  }
  seg[v << 1].add(seg[v].lazy);
  seg[(v << 1) + 1].add(seg[v].lazy);
  const int mid = (l + r) / 2;
  add(lp, rp, val, v << 1, l, mid);
  add(lp, rp, val, (v << 1) + 1, mid, r);
  seg[v] = seg[v << 1] + seg[(v << 1) + 1];
}
long long get(int lp, int rp, int v = 1, int l = 0, int r = n) {
  if (rp <= l || r <= lp) return inf;
  if (lp <= l && r <= rp) return seg[v].mn;
  seg[v << 1].add(seg[v].lazy);
  seg[(v << 1) + 1].add(seg[v].lazy);
  seg[v].lazy = 0;
  const int mid = (l + r) / 2;
  return min(get(lp, rp, v << 1, l, mid), get(lp, rp, (v << 1) + 1, mid, r));
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i], add(i, i + 1, a[i]);
  cin >> q;
  string trash;
  getline(cin, trash);
  while (q--) {
    string s;
    getline(cin, s);
    while (s.back() == ' ') s.pop_back();
    stringstream second;
    second << s;
    if (count(s.begin(), s.end(), ' ') == 2) {
      long long l, r, val;
      second >> l >> r >> val;
      if (l <= r)
        add(l, r + 1, val);
      else
        add(l, n, val), add(0, r + 1, val);
    } else {
      long long l, r;
      second >> l >> r;
      if (l <= r)
        cout << get(l, r + 1) << endl;
      else
        cout << min(get(l, n), get(0, r + 1)) << endl;
    }
  }
  return 0;
}
