#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 100;
const int INF = 0x7fffffff;
const long long mod = 998244353;
const long long mod1 = 1e9 + 7;
const long long base = 3993;
struct node {
  int l, r;
  long long lz;
  long long mn;
} tree[maxn * 4];
long long a[maxn];
int n;
void build(int i, int l, int r) {
  tree[i].l = l;
  tree[i].r = r;
  if (l == r) {
    tree[i].mn = a[l];
    tree[i].lz = 0;
    return;
  }
  int mid = (l + r) >> 1;
  build(i * 2, l, mid);
  build(i * 2 + 1, mid + 1, r);
  if (tree[i * 2 + 1].r >= 1 && tree[i * 2 + 1].r <= n)
    tree[i].mn = min(tree[i * 2].mn, tree[i * 2 + 1].mn);
  else if (tree[i * 2].r >= 1 && tree[i * 2 + 1].r <= n) {
    tree[i].mn = tree[i * 2].mn;
  }
  tree[i].lz = 0;
}
void pushdown(int i) {
  tree[i * 2].lz += tree[i].lz;
  tree[i * 2 + 1].lz += tree[i].lz;
  tree[i * 2].mn += tree[i].lz;
  tree[i * 2 + 1].mn += tree[i].lz;
  tree[i].lz = 0;
  return;
}
void update(int i, int l, int r, long long x) {
  if (tree[i].l > r || tree[i].r < l) return;
  if (tree[i].l >= l && tree[i].r <= r) {
    tree[i].mn += x;
    tree[i].lz += x;
    return;
  }
  pushdown(i);
  if (tree[i * 2].r >= l) update(i * 2, l, r, x);
  if (tree[i * 2 + 1].l <= r) update(i * 2 + 1, l, r, x);
  if (tree[i * 2 + 1].r >= 1 && tree[i * 2 + 1].r <= n)
    tree[i].mn = min(tree[i * 2].mn, tree[i * 2 + 1].mn);
  else if (tree[i * 2].r >= 1 && tree[i * 2 + 1].r <= n) {
    tree[i].mn = tree[i * 2].mn;
  }
}
long long search(int i, int l, int r) {
  if (tree[i].l > r || tree[i].r < l) return 1e17;
  if (tree[i].l >= l && tree[i].r <= r) {
    return tree[i].mn;
  }
  pushdown(i);
  long long s = 1e17;
  if (tree[i * 2].r >= l) s = min(s, search(i * 2, l, r));
  if (tree[i * 2 + 1].l <= r) s = min(s, search(i * 2 + 1, l, r));
  return s;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  build(1, 1, n);
  int m;
  scanf("%d", &m);
  while (m--) {
    int l, r;
    scanf("%d%d", &l, &r);
    char c = getchar();
    l++;
    r++;
    if (c != '\n') {
      long long v;
      scanf("%lld", &v);
      if (l > r) {
        update(1, 1, r, v);
        update(1, l, n, v);
      } else {
        update(1, l, r, v);
      }
    } else {
      if (l > r) {
        cout << min(search(1, 1, r), search(1, l, n)) << endl;
      } else {
        cout << search(1, l, r) << endl;
      }
    }
  }
}
