#include <bits/stdc++.h>
using namespace std;
long long d[4 * 2 * 1000000 + 1];
long long p[4 * 2 * 1000000 + 1];
long long delta[4 * 2 * 1000000 + 1];
void build(long long node, long long start, long long end) {
  if (start == end) {
    p[node] = d[start];
  } else {
    long long mid = (start + end) / 2;
    build(2 * node, start, mid);
    build(2 * node + 1, mid + 1, end);
    p[node] = min(p[2 * node], p[2 * node + 1]);
  }
}
long long query(long long node, long long start, long long end, long long l,
                long long r) {
  if (start > r || end < l || start > end) return 1e15;
  if (start >= l && end <= r) return p[node];
  delta[node * 2] += delta[node];
  p[node * 2] += delta[node];
  delta[node * 2 + 1] += delta[node];
  p[node * 2 + 1] += delta[node];
  delta[node] = 0;
  long long mid = (start + end) / 2;
  return min(query(node * 2, start, mid, l, r),
             query(node * 2 + 1, mid + 1, end, l, r));
}
void updateRange(long long node, long long start, long long end, long long l,
                 long long r, long long val) {
  if (start > r || end < l || start > end) return;
  if (start >= l && end <= r) {
    delta[node] += val;
    p[node] += val;
    return;
  }
  delta[node * 2] += delta[node];
  p[node * 2] += delta[node];
  delta[node * 2 + 1] += delta[node];
  p[node * 2 + 1] += delta[node];
  delta[node] = 0;
  long long mid = (start + end) / 2;
  updateRange(2 * node, start, mid, l, r, val);
  updateRange(2 * node + 1, mid + 1, end, l, r, val);
  p[node] = min(p[node * 2], p[node * 2 + 1]);
}
char s[100];
int main() {
  long long n, m;
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> d[i];
  build(1, 0, n - 1);
  cin >> m;
  gets(s);
  while (m--) {
    gets(s);
    long long a, b, c;
    if (sscanf(s, "%I64d  %I64d  %I64d", &a, &b, &c) == 3) {
      if (a <= b) {
        updateRange(1, 0, n - 1, a, b, c);
      } else {
        updateRange(1, 0, n - 1, a, n - 1, c);
        updateRange(1, 0, n - 1, 0, b, c);
      }
    } else {
      if (a <= b) {
        cout << query(1, 0, n - 1, a, b) << endl;
      } else {
        cout << min(query(1, 0, n - 1, a, n - 1), query(1, 0, n - 1, 0, b))
             << endl;
      }
    }
  }
}
