#include <bits/stdc++.h>
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cout << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
using namespace std;
long long a[200005];
vector<long long> tree(4 * 200005), lazy(4 * 200005);
void build(long long node, long long st, long long en) {
  if (st == en) {
    tree[node] = a[st];
    return;
  }
  long long mid = (st + en) / 2;
  build(2 * node + 1, st, mid);
  build(2 * node + 2, mid + 1, en);
  tree[node] = min(tree[2 * node + 1], tree[2 * node + 2]);
}
void update(long long node, long long st, long long en, long long l,
            long long r, long long val) {
  if (lazy[node] != 0) {
    tree[node] += lazy[node];
    if (st != en) {
      lazy[2 * node + 1] += lazy[node];
      lazy[2 * node + 2] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (st > r || en < l || st > en) return;
  if (st >= l && en <= r) {
    tree[node] += val;
    if (st != en) {
      lazy[2 * node + 1] += val;
      lazy[2 * node + 2] += val;
    }
    return;
  }
  long long mid = (st + en) / 2;
  update(2 * node + 1, st, mid, l, r, val);
  update(2 * node + 2, mid + 1, en, l, r, val);
  tree[node] = min(tree[2 * node + 1], tree[2 * node + 2]);
}
long long query(long long node, long long st, long long en, long long l,
                long long r) {
  if (st > en || st > r || en < l) return 1000000007;
  if (lazy[node] != 0) {
    tree[node] += lazy[node];
    if (st != en) {
      lazy[2 * node + 1] += lazy[node];
      lazy[2 * node + 2] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (st >= l && en <= r) return tree[node];
  long long mid = (st + en) / 2;
  return min(query(2 * node + 1, st, mid, l, r),
             query(2 * node + 2, mid + 1, en, l, r));
}
string tos(long long n) {
  stringstream ss;
  ss << n;
  string g = ss.str();
  return g;
}
long long toi(string s) {
  stringstream ss;
  ss << s;
  long long n;
  ss >> n;
  return n;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long i, j, n, m, k, cnt = 0, ans = 0, t = 1;
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  build(0, 0, n - 1);
  cin >> m;
  string s;
  getline(cin, s);
  for (i = 0; i < m; i++) {
    getline(cin, s);
    vector<long long> v;
    string temp;
    j = 0;
    while (j < s.length()) {
      if (s[j] != ' ') {
        temp += s[j];
      } else {
        v.push_back(toi(temp));
        temp.clear();
      }
      j++;
    }
    if (temp.length() > 0) v.push_back(toi(temp));
    if (v.size() == 2) {
      long long l = v[0], r = v[1];
      if (l <= r) {
        cout << query(0, 0, n - 1, l, r) << '\n';
      } else
        cout << min(query(0, 0, n - 1, l, n - 1), query(0, 0, n - 1, 0LL, r))
             << '\n';
    } else {
      long long l = v[0], r = v[1], w = v[2];
      if (l <= r)
        update(0, 0, n - 1, l, r, w);
      else
        update(0, 0, n - 1, l, n - 1, w), update(0, 0, n - 1, 0LL, r, w);
    }
  }
  return 0;
}
