#include <bits/stdc++.h>
using namespace std;
char bfr;
int n, q, lf, rg, v, i;
int *arr, *l, *r;
long long *mn, *dmn;
void init(int a, int b, int i = 1);
void prop(int i);
void update(int i);
void increment(int a, int b, int v, int i = 1);
long long queryMin(int a, int b, int i = 1);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  const clock_t begin_time = clock();
  scanf("%d", &n);
  arr = new int[n];
  l = new int[n * 4 + 1];
  r = new int[n * 4 + 1];
  mn = new long long[n * 4 + 1];
  dmn = new long long[n * 4 + 1];
  for (i = 0; i < n * 4 + 1; ++i) dmn[i] = 0;
  for (i = 0; i < n; ++i) scanf("%d", arr + i);
  init(0, n - 1);
  scanf("%d", &q);
  for (i = 0; i < q; ++i) {
    scanf("%d %d", &lf, &rg);
    scanf("%c", &bfr);
    if (bfr == '\n') {
      printf("%I64d\n", queryMin(lf, rg));
      continue;
    }
    scanf("%d", &v);
    increment(lf, rg, v);
  }
  ("\n=====\nUsed: %d ms",
   (int)(float(clock() - begin_time) / 1000 * CLOCKS_PER_SEC));
  return 0;
}
void init(int a, int b, int i) {
  l[i] = a;
  r[i] = b;
  if (a == b) {
    mn[i] = arr[a];
    return;
  }
  int m = (b + a) / 2;
  init(a, m, i * 2);
  init(m + 1, b, i * 2 + 1);
  update(i);
}
void prop(int i) {
  dmn[2 * i] += dmn[i];
  dmn[2 * i + 1] += dmn[i];
  dmn[i] = 0;
}
void update(int i) {
  i *= 2;
  mn[i / 2] = min(mn[i] + dmn[i], mn[i + 1] + dmn[i + 1]);
}
void increment(int a, int b, int v, int i) {
  if (b < a) {
    increment(a, n - 1, v, i);
    increment(0, b, v, i);
    return;
  }
  if (b < l[i] || r[i] < a) return;
  if (a <= l[i] && r[i] <= b) {
    dmn[i] += v;
    return;
  }
  prop(i);
  increment(a, b, v, i * 2);
  increment(a, b, v, i * 2 + 1);
  update(i);
}
long long queryMin(int a, int b, int i) {
  if (b < a) return min(queryMin(a, n - 1, i), queryMin(0, b, i));
  if (b < l[i] || r[i] < a) return (1 << 31) - 1;
  if (a <= l[i] && r[i] <= b) return mn[i] + dmn[i];
  prop(i);
  long long mnl = queryMin(a, b, i * 2);
  long long mnr = queryMin(a, b, i * 2 + 1);
  update(i);
  return min(mnl, mnr);
}
