#include <bits/stdc++.h>
using namespace std;
int movex[4] = {-1, 0, 1, 0};
int movey[4] = {0, 1, 0, -1};
int movex1[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int movey1[8] = {0, 1, 1, 1, 0, -1, -1, -1};
long long a[200005], tree[800005], lazy[800005];
void build(long long node, long long l, long long r) {
  if (l > r) return;
  if (l == r) {
    tree[node] = a[l];
    return;
  }
  long long mid = (l + r) / 2;
  build(node * 2, l, mid);
  build(node * 2 + 1, mid + 1, r);
  tree[node] = min(tree[node * 2], tree[node * 2 + 1]);
  return;
}
void update(long long node, long long L, long long R, long long l, long long r,
            long long val) {
  if (lazy[node]) {
    tree[node] += lazy[node];
    if (l != r) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (l > r || r < L || l > R) return;
  if (l >= L && r <= R) {
    tree[node] += val;
    if (l != r) {
      lazy[node * 2] += val;
      lazy[node * 2 + 1] += val;
    }
    lazy[node] = 0;
    return;
  }
  long long mid = (l + r) / 2;
  update(node * 2, L, R, l, mid, val);
  update(node * 2 + 1, L, R, mid + 1, r, val);
  tree[node] = min(tree[node * 2], tree[node * 2 + 1]);
  return;
}
long long query(long long node, long long L, long long R, long long l,
                long long r) {
  if (lazy[node]) {
    tree[node] += lazy[node];
    if (l != r) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (l > r || r < L || l > R) return 1e18;
  if (l >= L && r <= R) return tree[node];
  long long mid = (l + r) / 2;
  long long v1 = query(node * 2, L, R, l, mid);
  long long v2 = query(node * 2 + 1, L, R, mid + 1, r);
  return min(v1, v2);
}
int main() {
  long long n, i, q, j, p;
  scanf("%lld", &n);
  for (i = 1; i <= n; i += 1) scanf("%lld", &a[i]);
  build(1, 1, n);
  scanf("%lld", &q);
  while (q--) {
    long long l, r, val;
    char c;
    scanf("%lld", &l);
    scanf("%lld", &r);
    scanf("%c", &c);
    l++;
    r++;
    if (c == ' ') {
      scanf("%lld", &val);
      if (l > r) {
        update(1, l, n, 1, n, val);
        update(1, 1, r, 1, n, val);
        continue;
      }
      update(1, l, r, 1, n, val);
      continue;
    }
    if (l > r) {
      long long v1 = query(1, l, n, 1, n);
      long long v2 = query(1, 1, r, 1, n);
      printf("%lld\n", min(v1, v2));
      continue;
    }
    printf("%lld\n", query(1, l, r, 1, n));
  }
  return 0;
}
