#include <bits/stdc++.h>
using namespace std;
long long n, m, ab[1000005], f[1000005];
void init(int s, int e, int aa, int l, int r, int x) {
  if (s >= l and e <= r) {
    ab[aa] = x;
    return;
  }
  int mid = (s + e) / 2;
  if (l < mid) init(s, mid, 2 * (aa), l, r, x);
  if (r > mid) init(mid, e, 2 * (aa) + 1, l, r, x);
  ab[aa] = min(ab[2 * (aa)], ab[2 * (aa) + 1]);
  return;
}
void abc(int s, int e, int aa) {
  ab[2 * (aa)] += f[aa], f[2 * (aa)] += f[aa];
  ab[2 * (aa) + 1] += f[aa], f[2 * (aa) + 1] += f[aa];
  f[aa] = 0;
}
void add(int s, int e, int aa, int l, int r, int x) {
  if (s >= l and e <= r) {
    ab[aa] += x, f[aa] += x;
    return;
  }
  abc(s, e, aa);
  int mid = (s + e) / 2;
  if (l < mid) add(s, mid, 2 * (aa), l, r, x);
  if (r > mid) add(mid, e, 2 * (aa) + 1, l, r, x);
  ab[aa] = min(ab[2 * (aa)], ab[2 * (aa) + 1]);
  return;
}
long long solve(int s, int e, int aa, int l, int r) {
  if (s >= l and e <= r) return ab[aa];
  abc(s, e, aa);
  int mid = (s + e) / 2;
  long long ret = 1e18;
  if (l < mid) ret = min(ret, solve(s, mid, 2 * (aa), l, r));
  if (r > mid) ret = min(ret, solve(mid, e, 2 * (aa) + 1, l, r));
  return ret;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    init(1, n + 1, 1, i, i + 1, x);
  }
  cin >> m;
  for (int i = 1; i <= m; i++) {
    int l, r, x, t = 0;
    char c;
    scanf("%d%d%c", &l, &r, &c);
    if (c == '\n')
      t = 2;
    else {
      cin >> x;
      t = 1;
    }
    l++, r++;
    if (t == 1) {
      if (l <= r)
        add(1, n + 1, 1, l, r + 1, x);
      else {
        add(1, n + 1, 1, l, n + 1, x);
        add(1, n + 1, 1, 1, r + 1, x);
      }
    }
    if (t == 2) {
      if (l <= r)
        cout << solve(1, n + 1, 1, l, r + 1) << '\n';
      else
        cout << min(solve(1, n + 1, 1, l, n + 1), solve(1, n + 1, 1, 1, r + 1))
             << '\n';
    }
  }
  return 0;
}
