#include <bits/stdc++.h>
using namespace std;
int mn[200010 * 4], lazy_value[4 * 200010];
bool lazy[4 * 200010];
void update_node(int idx, int st, int ed, int val) {
  lazy[idx] = 1;
  lazy_value[idx] += val;
  mn[idx] += val;
}
void update_lazy(int idx, int st, int ed) {
  if (st == ed) return;
  int mid = (st + ed) / 2;
  update_node(2 * idx, st, mid, lazy_value[idx]);
  update_node(2 * idx + 1, mid + 1, ed, lazy_value[idx]);
  lazy[idx] = lazy_value[idx] = 0;
}
void insert(int idx, int st, int ed, int s, int e, int val) {
  if (st == s && ed == e) {
    update_node(idx, st, ed, val);
    return;
  }
  if (lazy[idx]) update_lazy(idx, st, ed);
  int mid = (st + ed) / 2;
  if (e <= mid)
    insert(idx * 2, st, mid, s, e, val);
  else if (s > mid)
    insert(idx * 2 + 1, mid + 1, ed, s, e, val);
  else {
    insert(idx * 2, st, mid, s, mid, val);
    insert(idx * 2 + 1, mid + 1, ed, mid + 1, e, val);
  }
  mn[idx] = min(mn[idx * 2], mn[idx * 2 + 1]);
}
int query(int idx, int st, int ed, int s, int e) {
  if (st == s && ed == e) return mn[idx];
  if (lazy[idx]) update_lazy(idx, st, ed);
  int mid = (st + ed) / 2;
  if (mid >= e)
    return query(2 * idx, st, mid, s, e);
  else if (s > mid)
    return query(2 * idx + 1, mid + 1, ed, s, e);
  else
    return min(query(idx * 2, st, mid, s, mid),
               query(idx * 2 + 1, mid + 1, ed, mid + 1, e));
}
int main() {
  int n, val, i, q, cnt, st, ed;
  string s_line;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> val;
    insert(1, 0, n - 1, i, i, val);
  }
  cin >> q;
  getchar();
  while (q--) {
    getline(cin, s_line);
    stringstream ss1;
    ss1 << s_line;
    ss1 >> st;
    ss1 >> ed;
    cnt = 0;
    while (ss1 >> val) cnt++;
    if (cnt) {
      if (st > ed) {
        insert(1, 0, n - 1, st, n - 1, val);
        insert(1, 0, n - 1, 0, ed, val);
      } else
        insert(1, 0, n - 1, st, ed, val);
    } else {
      if (st > ed)
        cout << min(query(1, 0, n - 1, st, n - 1), query(1, 0, n - 1, 0, ed));
      else
        cout << query(1, 0, n - 1, st, ed);
      cout << endl;
    }
  }
  return 0;
}
