#include <bits/stdc++.h>
using namespace std;
long long n, m;
vector<long long> a;
long long t[1600000], lazy[1600000];
void build(int id, int l, int r) {
  if (l == r) {
    t[id] = a[l];
    return;
  }
  int m = (l + r) / 2;
  build(2 * id, l, m);
  build(2 * id + 1, m + 1, r);
  t[id] = min(t[2 * id], t[2 * id + 1]);
}
void push(int id, int l, int r) {
  t[2 * id] += lazy[id];
  t[2 * id + 1] += lazy[id];
  lazy[2 * id] += lazy[id];
  lazy[2 * id + 1] += lazy[id];
  lazy[id] = 0;
}
void increase(int id, int l, int r, int x, int y, long long val) {
  if (x > r || y < l) return;
  if (x <= l && y >= r) {
    t[id] += val;
    lazy[id] += val;
    return;
  }
  push(id, l, r);
  int mid = (l + r) / 2;
  increase(2 * id, l, mid, x, y, val);
  increase(2 * id + 1, mid + 1, r, x, y, val);
  t[id] = min(t[2 * id], t[2 * id + 1]);
}
long long query(int id, int l, int r, int x, int y) {
  if (x > r || y < l) return 1e9;
  if (x <= l && y >= r) return t[id];
  push(id, l, r);
  int m = (l + r) / 2;
  long long p1 = query(2 * id, l, m, x, y);
  long long p2 = query(2 * id + 1, m + 1, r, x, y);
  return min(p1, p2);
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long temp;
    cin >> temp;
    a.push_back(temp);
  }
  build(1, 0, n - 1);
  cin >> m;
  while (m--) {
    int l, r;
    char c;
    long long val;
    scanf("%I64d %I64d%c", &l, &r, &c);
    if (c != '\n') {
      scanf("%lld", &val);
      if (l > r) {
        increase(1, 0, n - 1, l, n - 1, val);
        increase(1, 0, n - 1, 0, r, val);
      } else
        increase(1, 0, n - 1, l, r, val);
    } else {
      if (l > r)
        cout << min(query(1, 0, n - 1, l, n - 1), query(1, 0, n - 1, 0, r))
             << endl;
      else
        cout << query(1, 0, n - 1, l, r) << endl;
    }
  }
  return 0;
}
