#include <bits/stdc++.h>
using namespace std;
vector<long long> t, lazy;
void build(long long v, vector<long long>& a, long long tl, long long tr) {
  if (tl == tr) {
    t[v] = a[tl];
    lazy[v] = 0;
  } else {
    long long tm = (tl + tr) / 2;
    build(2 * v, a, tl, tm);
    build(2 * v + 1, a, tm + 1, tr);
    t[v] = min(t[2 * v], t[2 * v + 1]);
    lazy[v] = 0;
  }
}
void push(long long v, long long tl, long long tr) {
  if (lazy[v] != 0) {
    t[v] += lazy[v];
    if (tl != tr) {
      lazy[2 * v] += lazy[v];
      lazy[2 * v + 1] += lazy[v];
    }
    lazy[v] = 0;
  }
}
void update(long long v, long long tl, long long tr, long long l, long long r,
            long long val) {
  push(v, tl, tr);
  if (l > r) return;
  if (tl == l && tr == r) {
    t[v] += val;
    if (tl != tr) {
      lazy[2 * v] += val;
      lazy[2 * v + 1] += val;
    }
  } else {
    long long tm = (tl + tr) / 2;
    update(2 * v, tl, tm, l, min(r, tm), val);
    update(2 * v + 1, tm + 1, tr, max(tm + 1, l), r, val);
    t[v] = min(t[2 * v], t[2 * v + 1]);
  }
}
long long query(long long v, long long tl, long long tr, long long l,
                long long r) {
  push(v, tl, tr);
  if (l > r) return LLONG_MAX;
  if (tl == l && tr == r) {
    return t[v];
  } else {
    long long tm = (tl + tr) / 2;
    return min(query(2 * v, tl, tm, l, min(r, tm)),
               query(2 * v + 1, tm + 1, tr, max(tm + 1, l), r));
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, i, q;
  cin >> n;
  t.resize(5 * (n + 1));
  lazy.resize(5 * (n + 1));
  vector<long long> a(n);
  for (i = 0; i < n; i++) cin >> a[i];
  cin >> q;
  cin.ignore();
  build(1, a, 0, n - 1);
  while (q--) {
    string str, temp;
    vector<string> s;
    int l, r, v;
    getline(cin, str);
    for (i = 0; i < str.size(); i++) {
      if (str[i] == ' ') {
        s.push_back(temp);
        temp.clear();
      } else
        temp.push_back(str[i]);
    }
    s.push_back(temp);
    if (s.size() == 2) {
      stringstream g(s[0]), g1(s[1]);
      g >> l;
      g1 >> r;
      if (l > r)
        cout << min(query(1, 0, n - 1, l, n - 1), query(1, 0, n - 1, 0, r))
             << "\n";
      else
        cout << query(1, 0, n - 1, l, r) << "\n";
    } else {
      stringstream g(s[0]), g1(s[1]), g2(s[2]);
      g >> l;
      g1 >> r;
      g2 >> v;
      if (l > r) {
        update(1, 0, n - 1, l, n - 1, v);
        update(1, 0, n - 1, 0, r, v);
      } else
        update(1, 0, n - 1, l, r, v);
    }
  }
  return 0;
}
