#include <bits/stdc++.h>
using namespace std;
long long n, m, l, r, x;
const long long N = 200010, inf = 1e18;
long long tr[N << 2], lz[N << 2];
char ch;
inline long long read() {
  long long res = 0;
  char ch = getchar();
  bool XX = false;
  for (; !isdigit(ch); ch = getchar()) (ch == '-') && (XX = true);
  for (; isdigit(ch); ch = getchar()) res = (res << 3) + (res << 1) + (ch ^ 48);
  return XX ? -res : res;
}
void build(long long k, long long l, long long r) {
  if (l == r) {
    tr[k] = read();
    return;
  }
  build((k << 1), l, ((l + r) >> 1));
  build(((k << 1) | 1), ((l + r) >> 1) + 1, r);
  tr[k] = min(tr[(k << 1)], tr[((k << 1) | 1)]);
}
void cd(long long k) {
  tr[(k << 1)] += lz[k];
  lz[(k << 1)] += lz[k];
  tr[((k << 1) | 1)] += lz[k];
  lz[((k << 1) | 1)] += lz[k];
  lz[k] = 0;
}
long long ask(long long k, long long l, long long r, long long x, long long y) {
  if (x <= l && r <= y) return tr[k];
  if (lz[k]) cd(k);
  long long res = inf;
  if (x <= ((l + r) >> 1))
    res = min(res, ask((k << 1), l, ((l + r) >> 1), x, y));
  if (((l + r) >> 1) + 1 <= y)
    res = min(res, ask(((k << 1) | 1), ((l + r) >> 1) + 1, r, x, y));
  return res;
}
void change(long long k, long long l, long long r, long long x, long long y,
            long long val) {
  if (x <= l && r <= y) {
    tr[k] += val;
    lz[k] += val;
    return;
  }
  if (lz[k]) cd(k);
  if (x <= ((l + r) >> 1)) change((k << 1), l, ((l + r) >> 1), x, y, val);
  if (((l + r) >> 1) + 1 <= y)
    change(((k << 1) | 1), ((l + r) >> 1) + 1, r, x, y, val);
  tr[k] = min(tr[(k << 1)], tr[((k << 1) | 1)]);
}
signed main() {
  cin >> n;
  build(1, 1, n);
  cin >> m;
  while (m--) {
    scanf("%lld%lld", &l, &r);
    l++;
    r++;
    ch = getchar();
    if (ch == '\n') {
      if (l <= r)
        cout << ask(1, 1, n, l, r) << endl;
      else
        cout << min(ask(1, 1, n, 1, r), ask(1, 1, n, l, n)) << endl;
    } else {
      x = read();
      if (l <= r)
        change(1, 1, n, l, r, x);
      else
        change(1, 1, n, 1, r, x), change(1, 1, n, l, n, x);
    }
  }
  return 0;
}
