#include <bits/stdc++.h>
using namespace std;
long long n, m, len, k, t, a, b, c;
long long arr[200010 + 1];
long long tree[4 * 200010 + 1];
long long prop[4 * 200010 + 1];
long long f(long long x, long long y) { return min(x, y); }
void propagate(long long node, long long l, long long r) {
  if (prop[node] == 0) return;
  tree[node] += prop[node];
  if (l != r) {
    prop[((node << 1LL) + 1LL)] += prop[node];
    prop[((node << 1LL) + 2LL)] += prop[node];
  }
  prop[node] = 0;
}
void build(long long node, long long l, long long r) {
  if (l == r) {
    tree[node] = arr[l];
    return;
  }
  build(((node << 1LL) + 1LL), l, ((l + r) >> 1LL));
  build(((node << 1LL) + 2LL), ((l + r) >> 1LL) + 1, r);
  tree[node] = f(tree[((node << 1LL) + 1LL)], tree[((node << 1LL) + 2LL)]);
}
long long query(long long node, long long l, long long r, long long r1,
                long long r2) {
  if (l > r2 || r < r1) return 10000000000000007LL;
  propagate(node, l, r);
  if (r1 <= l && r <= r2) {
    return tree[node];
  }
  return f(query(((node << 1LL) + 1LL), l, ((l + r) >> 1LL), r1, r2),
           query(((node << 1LL) + 2LL), ((l + r) >> 1LL) + 1, r, r1, r2));
}
void update(long long node, long long l, long long r, long long r1,
            long long r2, long long val) {
  if (l > r2 || r < r1) return;
  propagate(node, l, r);
  if (r1 <= l && r <= r2) {
    prop[node] += val;
    propagate(node, l, r);
    return;
  }
  update(((node << 1LL) + 1LL), l, ((l + r) >> 1LL), r1, r2, val);
  update(((node << 1LL) + 2LL), ((l + r) >> 1LL) + 1, r, r1, r2, val);
  tree[node] = f(tree[((node << 1LL) + 1LL)] + prop[((node << 1LL) + 1LL)],
                 tree[((node << 1LL) + 2LL)] + prop[((node << 1LL) + 2LL)]);
}
int main() {
  cin >> n;
  for (long long i = 0; i <= n - 1; i++) cin >> arr[i];
  build(0, 0, n - 1);
  cin >> m;
  string s;
  getline(cin, s);
  while (m--) {
    getline(cin, s);
    long long l = 0, r = 0, z = 0, inc = 0, j = 0;
    while (s[j] != ' ') l *= 10, l += (s[j] - '0'), j++;
    j++;
    while (s[j] != ' ' && j < s.size()) r *= 10, r += (s[j] - '0'), j++;
    j++;
    if (j < s.size()) {
      inc = 1;
      bool neg = 0;
      if (s[j] == '-') j++, neg = 1;
      while (j < s.size()) z *= 10, z += (s[j++] - '0');
      if (neg) z *= -1;
    }
    if (!inc) {
      a = l;
      b = r;
      if (a <= b) {
        cout << query(0, 0, n - 1, a, b) << '\n';
      } else {
        cout << min(query(0, 0, n - 1, a, n - 1), query(0, 0, n - 1, 0, b))
             << '\n';
      }
    } else {
      a = l;
      b = r;
      c = z;
      if (a <= b) {
        update(0, 0, n - 1, a, b, c);
      } else {
        update(0, 0, n - 1, a, n - 1, c);
        update(0, 0, n - 1, 0, b, c);
      }
    }
  }
}
