#include <bits/stdc++.h>
using namespace std;
long long _();
int main() {
  _();
  return 0;
}
const long long INF = 1e12;
const long long N = 2e5;
long long t[2 * N];
long long d[N];
long long n, h;
void apply(long long p, long long value) {
  t[p] += value;
  if (p < n) d[p] += value;
}
void push(long long p) {
  for (long long i = h; i > 0; i--) {
    long long j = p >> i;
    if (d[j]) {
      apply(2 * j, d[j]);
      apply(2 * j + 1, d[j]);
      d[j] = 0;
    }
  }
}
void build(long long p) {
  while (p > 1) {
    p /= 2;
    t[p] = min(t[2 * p], t[2 * p + 1]) + d[p];
  }
}
long long query(long long l, long long r) {
  l += n;
  r += n;
  push(l);
  push(r - 1);
  long long res = INF;
  while (l < r) {
    if (l % 2) res = min(res, t[l++]);
    if (r % 2) res = min(res, t[--r]);
    l /= 2;
    r /= 2;
  }
  return res;
}
void inc(long long l, long long r, long long value) {
  l += n;
  r += n;
  long long l0 = l, r0 = r;
  while (l < r) {
    if (l % 2) apply(l++, value);
    if (r % 2) apply(--r, value);
    l /= 2;
    r /= 2;
  }
  build(l0);
  build(r0 - 1);
}
bool readInt(long long& a) {
  a = 0;
  for (char c, m = 1;;) {
    c = getchar();
    if (c == '-') {
      m = -1;
      continue;
    }
    if (c == ' ') return 1;
    if (c == '\n' || c == EOF) return 0;
    a = 10 * a + (c - '0') * m;
  }
}
void readInts(long long& a, long long& b, long long& c) {
  readInt(a);
  long long r = readInt(b);
  if (r)
    readInt(c);
  else
    c = INF;
}
long long _() {
  cin >> n;
  h = sizeof(long long) * 8 - __builtin_clzll(n);
  for (long long i = 0; i < n; i++) {
    long long x;
    scanf("%I64d", &x);
    inc(i, i + 1, x);
  }
  long long m;
  cin >> m;
  cin.ignore();
  while (m--) {
    long long v[3];
    readInts(v[0], v[1], v[2]);
    long long l = v[0], r = v[1];
    if (r < l) {
      if (v[2] == INF)
        printf("%I64d\n", min(query(0, r + 1), query(l, n)));
      else
        inc(0, r + 1, v[2]), inc(l, n, v[2]);
    } else if (v[2] == INF)
      printf("%I64d\n", query(l, r + 1));
    else
      inc(l, r + 1, v[2]);
  }
  return 0;
}
