#include <bits/stdc++.h>
using namespace std;
long double pi = 3.14159265358979323;
const double EPS = 1e-12;
const int N = 1e6 + 5;
const int mod = 998244353;
long long tree[N << 2], lazy[N << 2], a[N];
void build(long long node, long long start, long long end) {
  if (start == end) {
    tree[node] = a[start];
    return;
  }
  long long mid = (start + end) / 2;
  build(node * 2, start, mid);
  build(node * 2 + 1, mid + 1, end);
  tree[node] = min(tree[node * 2], tree[node * 2 + 1]);
}
void update(long long node, long long start, long long end, long long l,
            long long r, long long val) {
  if (lazy[node]) {
    tree[node] += (lazy[node]);
    if (start != end) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (start > end || end < l || start > r) return;
  if (start >= l && end <= r) {
    tree[node] += val;
    if (start != end) {
      lazy[node * 2] += val;
      lazy[node * 2 + 1] += val;
    }
    return;
  }
  long long mid = (start + end) / 2;
  update(node * 2, start, mid, l, r, val);
  update(node * 2 + 1, mid + 1, end, l, r, val);
  tree[node] = min(tree[node * 2], tree[node * 2 + 1]);
}
long long query(long long node, long long start, long long end, long long l,
                long long r) {
  if (lazy[node]) {
    tree[node] += (lazy[node]);
    if (start != end) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (end < l || start > r) return 1e18;
  if (start >= l && end <= r) return tree[node];
  long long mid = (start + end) / 2;
  long long s1 = query(node * 2, start, mid, l, r);
  long long s2 = query(node * 2 + 1, mid + 1, end, l, r);
  return min(s1, s2);
}
signed main() {
  long long n;
  scanf("%lld", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  build(1, 1, n);
  long long q;
  scanf("%lld", &q);
  while (q--) {
    long long l, r, val;
    char c;
    scanf("%lld%lld%c", &l, &r, &c);
    l++, r++;
    if (c == '\n') {
      if (l <= r)
        printf("%lld\n", query(1, 1, n, l, r));
      else {
        cout << min(query(1, 1, n, 1, r), query(1, 1, n, l, n)) << "\n";
      }
    } else {
      scanf("%lld", &val);
      if (l <= r)
        update(1, 1, n, l, r, val);
      else {
        update(1, 1, n, 1, r, val);
        update(1, 1, n, l, n, val);
      }
    }
  }
  return 0;
}
