#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
long long INF = 1e17;
int n;
int a[N];
long long d[4][N];
int neg[4];
string s;
int m;
long long seg[N << 2];
long long lazy[N << 2];
void build(int l, int r, int i) {
  if (l == r) {
    seg[i] = a[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, i << 1);
  build(mid + 1, r, i << 1 | 1);
  seg[i] = min(seg[i << 1], seg[i << 1 | 1]);
}
int query(int l, int r, int from, int to, int i) {
  if (lazy[i] != 0) {
    seg[i] += lazy[i];
    if (l != r) {
      lazy[i << 1] += lazy[i], lazy[i << 1 | 1] += lazy[i];
    }
    lazy[i] = 0;
  }
  if (from <= l && to >= r) {
    return seg[i];
  } else if (to < l || from > r)
    return INF;
  else {
    int mid = (l + r) >> 1;
    long long ans1 = query(l, mid, from, to, i << 1);
    long long ans2 = query(mid + 1, r, from, to, i << 1 | 1);
    return min(ans1, ans2);
  }
}
void update_rang(int l, int r, int from, int to, int i, int cha) {
  if (from <= l && to >= r) {
    lazy[i] += cha;
    return;
  } else if (to < l || from > r)
    return;
  else {
    int mid = (l + r) >> 1;
    update_rang(l, mid, from, to, i << 1, cha);
    update_rang(mid + 1, r, from, to, i << 1 | 1, cha);
    seg[i] =
        min(seg[i << 1] + lazy[i << 1], seg[i << 1 | 1] + lazy[i << 1 | 1]);
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  cin >> m;
  getline(cin, s);
  for (int i = 0; i < m; i++) {
    getline(cin, s);
    int k = 0;
    neg[0] = 0, neg[1] = 0, neg[2] = 0;
    for (int j = 0; j < s.length(); j++) {
      if (s[j] == '-')
        neg[k] = 1;
      else if (s[j] == ' ')
        k++;
      else {
        d[k][i] *= 10;
        d[k][i] += int(s[j] - '0');
        if (j == s.length() - 1 && k == 1) {
          d[k + 1][i] = INF;
        }
      }
    }
    if (neg[0]) d[0][i] *= -1;
    if (neg[1]) d[1][i] *= -1;
    if (neg[2]) d[2][i] *= -1;
  }
  build(0, n - 1, 1);
  for (int i = 0; i < m; i++) {
    if (d[2][i] != 1e17) {
      if (d[0][i] > d[1][i]) {
        update_rang(0, n - 1, d[0][i], n - 1, 1, d[2][i]);
        update_rang(0, n - 1, 0, d[1][i], 1, d[2][i]);
      } else
        update_rang(0, n - 1, d[0][i], d[1][i], 1, d[2][i]);
    } else {
      if (d[0][i] > d[1][i]) {
        long long ans1 = query(0, n - 1, d[0][i], n - 1, 1);
        long long ans2 = query(0, n - 1, 0, d[1][i], 1);
        cout << min(ans1, ans2) << endl;
      } else
        cout << query(0, n - 1, d[0][i], d[1][i], 1) << endl;
    }
  }
  return 0;
}
