#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
const long long INF = 1e18;
long long t[4 * MAXN], lazy[4 * MAXN];
void build(int v, int l, int r, int a[]) {
  if (l == r) {
    t[v] = a[l];
    return;
  }
  int m = (l + r) >> 1;
  build(2 * v, l, m, a);
  build(2 * v + 1, m + 1, r, a);
  t[v] = min(t[2 * v], t[2 * v + 1]);
  return;
}
void push(int v) {
  t[v * 2] += lazy[v];
  lazy[v * 2] += lazy[v];
  t[v * 2 + 1] += lazy[v];
  lazy[v * 2 + 1] += lazy[v];
  lazy[v] = 0;
}
void update(int v, int tl, int tr, int l, int r, int addend) {
  if (l > tr || r < tl) return;
  if (tl >= l && tr <= r) {
    t[v] += addend;
    lazy[v] += addend;
  } else {
    push(v);
    int tm = (tl + tr) / 2;
    update(v * 2, tl, tm, l, r, addend);
    update(v * 2 + 1, tm + 1, tr, l, r, addend);
    t[v] = min(t[v * 2], t[v * 2 + 1]);
  }
}
long long get_value(int v, int tl, int tr, int l, int r) {
  if (l > tr || r < tl) return INF;
  if (tl >= l && tr <= r) return t[v];
  push(v);
  int tm = (tl + tr) / 2;
  return min(get_value(v * 2, tl, tm, l, r),
             get_value(v * 2 + 1, tm + 1, tr, l, r));
}
int main() {
  long long n, j = 0, m, x;
  char temp;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  build(1, 0, n - 1, a);
  cin >> m;
  int b[3];
  for (int i = 0; i < m; ++i) {
    do {
      scanf("%d%c", &b[j], &temp);
      j++;
    } while (temp != '\n');
    j--;
    if (j == 2) {
      if (b[0] <= b[1]) {
        update(1, 0, n - 1, b[0], b[1], b[2]);
      } else {
        update(1, 0, n - 1, b[0], n - 1, b[2]);
        update(1, 0, n - 1, 0, b[1], b[2]);
      }
    } else {
      if (b[0] <= b[1]) {
        x = get_value(1, 0, n - 1, b[0], b[1]);
      } else {
        x = min(get_value(1, 0, n - 1, 0, b[1]),
                get_value(1, 0, n - 1, b[0], n - 1));
      }
      cout << x << "\n";
    }
    j = 0;
  }
}
