#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
long long seg[4 * N], lazy[4 * N], INF = 1e18;
int a[N];
int n;
void build(int id = 1, int s = 0, int e = n - 1) {
  if (s == e) {
    seg[id] = a[s];
    return;
  }
  int mid = s + (e - s) / 2;
  build(id * 2, s, mid);
  build(id * 2 + 1, mid + 1, e);
  seg[id] = min(seg[id * 2], seg[id * 2 + 1]);
}
long long query(int sq, int eq, int id = 1, int s = 0, int e = n - 1) {
  if (s > eq || e < sq) return INF;
  if (s >= sq && e <= eq) return seg[id] + lazy[id];
  int mid = s + (e - s) / 2;
  return min(query(sq, eq, id * 2, s, mid),
             query(sq, eq, id * 2 + 1, mid + 1, e)) +
         lazy[id];
}
void update(int su, int eu, int val, int id = 1, int s = 0, int e = n - 1) {
  if (s > eu || e < su) return;
  if (s >= su && e <= eu) {
    lazy[id] += val;
    return;
  }
  int mid = s + (e - s) / 2;
  update(su, eu, val, id * 2, s, mid);
  update(su, eu, val, id * 2 + 1, mid + 1, e);
  seg[id] = min(seg[id * 2] + lazy[id * 2], seg[id * 2 + 1] + lazy[id * 2 + 1]);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int m;
  cin >> m;
  cin.ignore();
  build();
  while (m--) {
    string s;
    getline(cin, s);
    int l = 0, r = 0, v = 0, cnt = 0, f = 1;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == ' ')
        cnt++;
      else if (cnt == 0)
        l = l * 10 + s[i] - '0';
      else if (cnt == 1)
        r = r * 10 + s[i] - '0';
      else if (cnt == 2) {
        if (s[i] == '-')
          f = -1;
        else
          v = v * 10 + s[i] - '0';
      }
    }
    v *= f;
    if (cnt == 1) {
      if (l <= r)
        cout << query(l, r) << endl;
      else
        cout << min(query(l, n - 1), query(0, r)) << endl;
    } else {
      if (l <= r)
        update(l, r, v);
      else {
        update(l, n - 1, v);
        update(0, r, v);
      }
    }
  }
  return 0;
}
