#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const double eps = 1e6 - 10;
const int maxn = 2e5 + 10;
const long long inf = 0x3f3f3f3f3f3f3f3f;
int num[maxn];
long long ans;
struct node {
  int l, r;
  long long mi;
  long long lazy;
} tree[maxn << 2];
void pushDown(int x, int sz) {
  if (tree[x].lazy) {
    tree[x << 1].lazy += tree[x].lazy;
    tree[(x << 1) | 1].lazy += tree[x].lazy;
    tree[x << 1].mi += tree[x].lazy;
    tree[(x << 1) | 1].mi += tree[x].lazy;
    tree[x].lazy = 0;
  }
  return;
}
void build(int x, int lf, int rt) {
  tree[x].l = lf;
  tree[x].r = rt;
  tree[x].lazy = 0;
  if (lf == rt) {
    tree[x].mi = num[lf];
    return;
  }
  int mid = (lf + rt) >> 1;
  build(x << 1, lf, mid);
  build((x << 1) | 1, mid + 1, rt);
  tree[x].mi = min(tree[x << 1].mi, tree[(x << 1) | 1].mi);
  return;
}
long long query2(int x, int lf, int rt) {
  int l = tree[x].l;
  int r = tree[x].r;
  if (lf > r || rt < l) return inf;
  if (lf <= l && rt >= r) return tree[x].mi;
  pushDown(x, r - l + 1);
  long long ret = inf;
  int mid = (l + r) >> 1;
  if (lf <= mid) ret = min(ret, query2(x << 1, lf, rt));
  if (rt > mid) ret = min(ret, query2((x << 1) | 1, lf, rt));
  return ret;
}
void change(int x, int lf, int rt, long long add) {
  int l = tree[x].l;
  int r = tree[x].r;
  if (lf <= l && rt >= r) {
    tree[x].lazy += add;
    tree[x].mi += add;
    return;
  }
  pushDown(x, r - l + 1);
  int mid = (l + r) >> 1;
  if (lf <= mid) change(x << 1, lf, rt, add);
  if (rt > mid) change((x << 1) | 1, lf, rt, add);
  if (l != r) tree[x].mi = min(tree[x << 1].mi, tree[(x << 1) | 1].mi);
  return;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n + 1; i++) scanf("%d", &num[i]);
  build(1, 1, n);
  int q;
  scanf("%d", &q);
  getchar();
  while (q--) {
    char s[10];
    gets(s);
    int l, r;
    long long val;
    if (sscanf(s, "%d %d %lld", &l, &r, &val) == 3) {
      l++;
      r++;
      if (l > r) {
        change(1, 1, r, val);
        change(1, l, n, val);
      } else {
        change(1, l, r, val);
      }
    } else {
      l++;
      r++;
      ans = inf;
      if (l > r) {
        ans = min(ans, query2(1, 1, r));
        ans = min(ans, query2(1, l, n));
      } else {
        ans = min(ans, query2(1, l, r));
      }
      printf("%lld\n", ans);
    }
  }
  return 0;
}
