#include <bits/stdc++.h>
using namespace std;
int n, m;
long long arr[200200];
long long nod[800800];
long long upd[800800];
void build(int ind, int s, int e) {
  if (s == e) {
    nod[ind] = arr[s];
    return;
  }
  int mid = (s + e) / 2;
  build(ind * 2, s, mid);
  build(ind * 2 + 1, mid + 1, e);
  nod[ind] = min(nod[ind * 2], nod[ind * 2 + 1]);
  return;
}
void update(int ind, int s, int e, int l, int r, long long v) {
  if (s == l && e == r) upd[ind] += v;
  nod[ind] += upd[ind];
  if (ind * 2 + 1 < 800800) {
    upd[ind * 2] += upd[ind];
    upd[ind * 2 + 1] += upd[ind];
  }
  upd[ind] = 0;
  if (s == l && e == r) return;
  if (s > r || e < l || l > r) return;
  int mid = (s + e) / 2;
  update(ind * 2, s, mid, l, min(mid, r), v);
  update(ind * 2 + 1, mid + 1, e, max(mid + 1, l), r, v);
  nod[ind] = min(nod[ind * 2], nod[ind * 2 + 1]);
  return;
}
long long query(int ind, int s, int e, int l, int r) {
  nod[ind] += upd[ind];
  if (ind * 2 + 1 < 800800) {
    upd[ind * 2] += upd[ind];
    upd[ind * 2 + 1] += upd[ind];
  }
  upd[ind] = 0;
  if (s == l && e == r) return nod[ind];
  if (s > r || e < l || l > r) return 1LL << 62;
  int mid = (s + e) / 2;
  long long ret = min(query(ind * 2, s, mid, l, min(mid, r)),
                      query(ind * 2 + 1, mid + 1, e, max(mid + 1, l), r));
  return ret;
}
void convertnrun(string str) {
  int cur = 0;
  int l = 0;
  bool tbn = false;
  vector<int> cv;
  for (int i = 0; i < str.size(); i++) {
    if (str[i] == ' ') {
      if (!l) continue;
      cv.push_back(cur * (tbn ? -1 : 1));
      cur = l = 0;
      tbn = false;
      continue;
    }
    if (str[i] == '-') {
      tbn = true;
      continue;
    }
    cur *= 10;
    cur += str[i] - '0';
    l++;
  }
  if (l) cv.push_back(cur * (tbn ? -1 : 1));
  if (cv.size() == 2) {
    if (cv[1] < cv[0])
      cout << min(query(1, 0, n - 1, 0, cv[1]),
                  query(1, 0, n - 1, cv[0], n - 1))
           << endl;
    else
      cout << query(1, 0, n - 1, cv[0], cv[1]) << endl;
  } else {
    if (cv[1] < cv[0]) {
      update(1, 0, n - 1, 0, cv[1], cv[2]);
      update(1, 0, n - 1, cv[0], n - 1, cv[2]);
    } else
      update(1, 0, n - 1, cv[0], cv[1], cv[2]);
  }
  return;
}
int main() {
  scanf("%d", &n);
  memset(upd, 0, sizeof(upd));
  for (int i = 0; i < n; i++) scanf("%I64d", &arr[i]);
  build(1, 0, n - 1);
  scanf("%d", &m);
  getchar();
  for (int i = 0; i < m; i++) {
    char x[500];
    gets(x);
    string str = x;
    convertnrun(str);
  }
  return 0;
}
