#include <bits/stdc++.h>
using namespace std;
const int N = 2 * (1e5) + 7;
const int MOD = (1e9) + 7;
const long long INF = (1e18) + 1;
const long double pi = 2 * acos(0.0);
const double eps = (1e-6);
int dx[8] = {2, 2, 1, 1, -1, -1, -2, -2};
int dy[8] = {1, -1, 2, -2, 2, -2, 1, -1};
vector<int> a;
vector<long long> t, p;
char buf[100];
inline void push(int v) {
  if (!p[v]) return;
  t[v + v + 1] += p[v];
  t[v + v + 2] += p[v];
  p[v + v + 1] += p[v];
  p[v + v + 2] += p[v];
  p[v] = 0;
}
inline void build(int v, int l, int r) {
  if (l == r - 1) {
    t[v] = a[l];
    return;
  }
  int mid = (l + r) / 2;
  build(v + v + 1, l, mid);
  build(v + v + 2, mid, r);
  t[v] = min(t[v + v + 1], t[v + v + 2]);
}
long long get(int v, int l, int r, int ql, int qr) {
  push(v);
  if (l >= qr || ql >= r) return INF;
  if (ql <= l && r <= qr) return t[v];
  int mid = (l + r) / 2;
  return min(get(v + v + 1, l, mid, ql, qr), get(v + v + 2, mid, r, ql, qr));
}
inline void update(int v, int l, int r, int ql, int qr, long long val) {
  push(v);
  if (ql >= r || l >= qr) return;
  push(v);
  if (ql <= l && r <= qr) {
    t[v] += val;
    p[v] += val;
    push(v);
    return;
  }
  int mid = (l + r) / 2;
  update(v + v + 1, l, mid, ql, qr, val);
  update(v + v + 2, mid, r, ql, qr, val);
  push(v);
  t[v] = min(t[v + v + 1], t[v + v + 2]);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  int n;
  scanf("%d", &n);
  t.resize(n << 3);
  p.resize(n << 3);
  a.resize(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  build(0, 0, n);
  int m;
  scanf("%d\n", &m);
  while (m--) {
    gets(buf);
    int ql, qr, addend;
    if (sscanf(buf, "%d %d %d", &ql, &qr, &addend) == 2) {
      if (ql <= qr)
        cout << get(0, 0, n, ql, qr + 1) << endl;
      else
        cout << min(get(0, 0, n, 0, qr + 1), get(0, 0, n, ql, n)) << endl;
    } else {
      if (ql <= qr) {
        update(0, 0, n, ql, qr + 1, addend);
      } else {
        update(0, 0, n, 0, qr + 1, addend);
        update(0, 0, n, ql, n, addend);
      }
    }
  }
  return false;
}
