#include <bits/stdc++.h>
using namespace std;
long long arr[200005], lazy[4 * 200005], seg[4 * 200005];
void build(int node, int start, int end) {
  int mid = (start + end) / 2;
  if (start == end) {
    lazy[node] = 0;
    seg[node] = arr[start];
    return;
  }
  build(2 * node, start, mid);
  build(2 * node + 1, mid + 1, end);
  seg[node] = min(seg[2 * node], seg[2 * node + 1]);
}
void update(int node, int start, int end, int left, int right, long long val) {
  int mid = (start + end) / 2;
  if ((start > right) || (end < left)) return;
  if ((left <= start) && (end <= right)) {
    lazy[node] += val;
    seg[node] += val;
    return;
  } else {
    update(2 * node, start, mid, left, right, val);
    update(2 * node + 1, mid + 1, end, left, right, val);
    seg[node] = min(seg[2 * node], seg[2 * node + 1]) + lazy[node];
  }
}
long long query(int node, int start, int end, int left, int right) {
  int mid = (start + end) / 2;
  if ((start > right) || (end < left)) return LLONG_MAX;
  if ((left <= start) && (end <= right))
    return seg[node];
  else
    return lazy[node] + min(query(2 * node, start, mid, left, right),
                            query(2 * node + 1, mid + 1, end, left, right));
}
int main() {
  int n, m, lf, rg;
  long long v;
  char c;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%lld", &arr[i]);
  build(1, 0, n - 1);
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &lf, &rg);
    c = getchar();
    if (c != '\n') {
      scanf("%lld", &v);
      if (lf <= rg)
        update(1, 0, n - 1, lf, rg, v);
      else {
        update(1, 0, n - 1, lf, n - 1, v);
        update(1, 0, n - 1, 0, rg, v);
      }
    } else {
      if (lf <= rg)
        printf("%lld\n", query(1, 0, n - 1, lf, rg));
      else
        printf("%lld\n",
               min(query(1, 0, n - 1, lf, n - 1), query(1, 0, n - 1, 0, rg)));
    }
  }
  return 0;
}
