#include <bits/stdc++.h>
using namespace std;
void freekick() {}
const int DX[] = {+1, 0, -1, 0, +1, +1, -1, -1};
const int DY[] = {0, +1, 0, -1, +1, -1, +1, -1};
const int MAX = 2e5;
const int INF32 = INT_MAX;
const long long INF64 = ((long long)INF32 << 29ll);
void freegoal() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
}
int n;
vector<long long> a;
long long mn[MAX << 3];
long long tag[MAX << 3];
void push(int u) {
  if (!tag[u]) return;
  mn[u + u + 1] += tag[u];
  mn[u + u + 2] += tag[u];
  tag[u + u + 1] += tag[u];
  tag[u + u + 2] += tag[u];
  tag[u] = 0;
}
void build(int u = 0, int l = 0, int r = n) {
  if (r - l == 1) {
    mn[u] = a[l];
    return;
  }
  int m = (l + r) >> 1;
  build(u + u + 1, l, m);
  build(u + u + 2, m, r);
  mn[u] = min(mn[u + u + 1], mn[u + u + 2]);
}
void modify(int l, int r, long long val, int u = 0, int ul = 0, int ur = n) {
  push(u);
  if (ul >= r || l >= ur) return;
  push(u);
  if (l <= ul && ur <= r) {
    mn[u] += val;
    tag[u] += val;
    push(u);
    return;
  }
  push(u);
  int um = (ul + ur) >> 1;
  modify(l, r, val, u + u + 1, ul, um);
  modify(l, r, val, u + u + 2, um, ur);
  push(u);
  mn[u] = min(mn[u + u + 1], mn[u + u + 2]);
}
long long get(int l, int r, int u = 0, int ul = 0, int ur = n) {
  push(u);
  if (ul >= r || l >= ur) return INF64;
  push(u);
  if (l <= ul && ur <= r) return mn[u];
  push(u);
  int um = (ul + ur) >> 1;
  return min(get(l, r, u + u + 1, ul, um), get(l, r, u + u + 2, um, ur));
}
signed main() {
  freekick();
  scanf("%d", &n);
  a.resize(n + 1);
  for (int i = 0; i < n; i++) cin >> a[i];
  build();
  int q;
  scanf("%d", &q);
  q++;
  while (q--) {
    int l, r, value;
    char buf[100];
    gets(buf);
    if (sscanf(buf, "%d %d %d", &l, &r, &value) == 2) {
      if (l <= r)
        printf("%I64d\n", get(l, r + 1));
      else
        printf("%I64d\n", min(get(l, n), get(0, r + 1)));
    }
    if (sscanf(buf, "%d %d %d", &l, &r, &value) == 3) {
      if (l > r) {
        modify(l, n, value);
        modify(0, r + 1, value);
      } else
        modify(l, r + 1, value);
    }
  }
  return false;
}
