#include <bits/stdc++.h>
using namespace std;
const int maxm = 2e5 + 5;
const int inf = 0x3f3f3f3f;
int n, m;
struct NODE {
  int l, r;
  int mid() { return (l + r) >> 1; }
} node[maxm << 2];
long long add[maxm << 2], minn[maxm << 2];
void pushup(int ri) { minn[ri] = min(minn[ri << 1], minn[ri << 1 | 1]); }
void pushdown(int ri) {
  if (add[ri]) {
    add[ri << 1] += add[ri];
    add[ri << 1 | 1] += add[ri];
    minn[ri << 1] += add[ri];
    minn[ri << 1 | 1] += add[ri];
  }
  add[ri] = 0;
}
void build(int ri, int l, int r) {
  node[ri].l = l;
  node[ri].r = r;
  add[ri] = 0;
  minn[ri] = 0;
  if (node[ri].l == node[ri].r) {
    cin >> minn[ri];
    return;
  }
  int m = node[ri].mid();
  build(ri << 1, l, m);
  build(ri << 1 | 1, m + 1, r);
  pushup(ri);
}
void update(int ri, int l, int r, int val) {
  if (l == node[ri].l && r == node[ri].r) {
    add[ri] += val;
    minn[ri] += val;
    return;
  }
  if (node[ri].l == node[ri].r) return;
  pushdown(ri);
  int m = node[ri].mid();
  if (r <= m)
    update(ri << 1, l, r, val);
  else if (l > m)
    update(ri << 1 | 1, l, r, val);
  else {
    update(ri << 1, l, m, val);
    update(ri << 1 | 1, m + 1, r, val);
  }
  pushup(ri);
}
long long query(int ri, int l, int r) {
  if (l == node[ri].l && r == node[ri].r) {
    return minn[ri];
  }
  if (node[ri].l == node[ri].r) return minn[ri];
  pushdown(ri);
  long long res = inf;
  int m = node[ri].mid();
  if (r <= m)
    res = query(ri << 1, l, r);
  else if (l > m)
    res = min(res, query(ri << 1 | 1, l, r));
  else {
    res = min(res, min(query(ri << 1, l, m), query(ri << 1 | 1, m + 1, r)));
  }
  return res;
}
char ch[10];
int main() {
  cin >> n;
  build(1, 1, n);
  cin >> m;
  while (m--) {
    int l, r, v;
    cin >> l >> r;
    if (getchar() == ' ') {
      cin >> v;
      l++, r++;
      if (r < l) {
        update(1, l, n, v);
        update(1, 1, r, v);
      } else {
        update(1, l, r, v);
      }
    } else {
      l++, r++;
      long long res = 0;
      if (r < l) {
        res = min(query(1, l, n), query(1, 1, r));
      } else {
        res = query(1, l, r);
      }
      cout << res << endl;
    }
  }
  return 0;
}
