#include <bits/stdc++.h>
using namespace std;
long long data[200001], datatest[200001], seg_tree[200001 * 4],
    delta_tree[4 * 200001], lo[4 * 200001], hi[4 * 200001];
void update(int node) {
  seg_tree[node] = min(seg_tree[node * 2] + delta_tree[node * 2],
                       seg_tree[node * 2 + 1] + delta_tree[node * 2 + 1]);
}
void propagate(int node) {
  delta_tree[node * 2] += delta_tree[node];
  delta_tree[node * 2 + 1] += delta_tree[node];
  delta_tree[node] = 0;
}
void segment_tree_build(int node, int l, int r) {
  lo[node] = l;
  hi[node] = r;
  delta_tree[node] = 0;
  if (l == r) {
    seg_tree[node] = data[l];
    return;
  } else {
    int mid = (l + r) / 2;
    segment_tree_build(node * 2, l, mid);
    segment_tree_build((node * 2) + 1, mid + 1, r);
    update(node);
  }
}
void increment(int node, int ql, int qr, int val) {
  if (lo[node] > qr || hi[node] < ql) return;
  if (lo[node] >= ql && hi[node] <= qr) {
    delta_tree[node] += val;
    return;
  }
  propagate(node);
  increment(node * 2, ql, qr, val);
  increment(node * 2 + 1, ql, qr, val);
  update(node);
}
long long query(int node, int ql, int qr) {
  if (qr < lo[node] || ql > hi[node]) return LONG_MAX;
  if (lo[node] >= ql && hi[node] <= qr) {
    return seg_tree[node] + delta_tree[node];
  }
  propagate(node);
  int lSegment = query(node * 2, ql, qr);
  int rSegment = query((node * 2) + 1, ql, qr);
  update(node);
  return min(lSegment, rSegment);
}
void BruteforceUpdate(int ql, int qr, int val) {
  for (int i = ql; i <= qr; i++) datatest[i] += val;
}
int BruteForce(int ql, int qr) {
  int mn = 0;
  for (int i = ql; i <= qr; i++) mn += datatest[i];
  return mn;
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  int n, q;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> data[i];
  segment_tree_build(1, 0, n - 1);
  cin >> q;
  string s, ara[3];
  getline(cin, s);
  for (int i = 0; i < q; i++) {
    int ql, qr, val;
    getline(cin, s);
    istringstream ss(s);
    int c = 0;
    while (ss) {
      ss >> ara[c];
      c++;
    }
    if (c == 3) {
      istringstream cc(ara[0]);
      cc >> ql;
      istringstream ccc(ara[1]);
      ccc >> qr;
      if (ql <= qr)
        cout << query(1, ql, qr) << endl;
      else
        cout << min(query(1, ql, n - 1), query(1, 0, qr)) << endl;
    } else {
      istringstream cc(ara[0]);
      cc >> ql;
      istringstream ccc(ara[1]);
      ccc >> qr;
      istringstream cccc(ara[2]);
      cccc >> val;
      if (ql <= qr)
        increment(1, ql, qr, val);
      else {
        increment(1, ql, n - 1, val);
        increment(1, 0, qr, val);
      }
    }
  }
  return 0;
}
