#include <bits/stdc++.h>
using namespace std;
vector<long long> A;
vector<long long> T;
vector<long long> add;
void buildTree(int index, int start, int end) {
  add[index] = 0;
  if (end == start) {
    T[index] = A[start];
  } else {
    buildTree(2 * index, start, (start + end) / 2);
    buildTree(2 * index + 1, (start + end) / 2 + 1, end);
    T[index] = min(T[2 * index], T[2 * index + 1]);
  }
}
void prepareNode(int node, int start, int end) {
  add[2 * node] += add[node];
  add[2 * node + 1] += add[node];
  T[2 * node] += add[node];
  T[2 * node + 1] += add[node];
  add[node] = 0;
}
int query(int node, int start, int end, int i, int j) {
  if (start >= i && end <= j) {
    return T[node];
  } else if (end < i || start > j) {
    return INT_MAX;
  } else {
    prepareNode(node, start, end);
    int res1 = query(2 * node, start, (start + end) / 2, i, j);
    int res2 = query(2 * node + 1, (start + end) / 2 + 1, end, i, j);
    return min(res1, res2);
  }
}
void update(int node, int start, int end, int i, int j, int val) {
  if (start >= i && end <= j) {
    T[node] += val;
    add[node] += val;
  } else if (start > j || end < i) {
    return;
  } else {
    prepareNode(node, start, end);
    update(2 * node, start, (start + end) / 2, i, j, val);
    update(2 * node + 1, (start + end) / 2 + 1, end, i, j, val);
    T[node] = min(T[2 * node], T[2 * node + 1]);
  }
}
long long strToInt(string num) {
  int sign = 1;
  if (num[0] == '-') sign *= -1, num.erase(num.begin());
  int ret = 0;
  while (!num.empty()) {
    ret *= 10;
    ret += num[0] - '0';
    num.erase(num.begin());
  }
  return ret * sign;
}
int main() {
  int size, op;
  string q;
  long long start, end, val, res;
  string temp;
  while (cin >> size) {
    int c = 1;
    while (c < size) c *= 2;
    A.clear();
    A.resize(c + 1);
    T.resize(2 * c);
    add.clear();
    add.resize(2 * c, 0);
    for (int i = 1; i <= c; i++) {
      if (i <= size)
        cin >> A[i];
      else
        A[i] = INT_MAX;
    }
    cin >> op;
    cin.ignore();
    buildTree(1, 1, size);
    for (int i = 0; i < op; i++) {
      getline(cin, q);
      int j = 0;
      temp.clear();
      while (q[j] != ' ') temp += q[j++];
      start = strToInt(temp);
      temp.clear();
      j++;
      while (j < q.size() && q[j] != ' ') temp += q[j++];
      end = strToInt(temp);
      start++, end++;
      if (j < q.size()) {
        j++;
        temp.clear();
        while (j < q.size()) temp += q[j++];
        val = strToInt(temp);
        if (end < start) {
          update(1, 1, size, 1, end, val);
          update(1, 1, size, start, size, val);
        } else
          update(1, 1, size, start, end, val);
      } else {
        if (end < start) {
          long long res1, res2;
          res1 = query(1, 1, size, 1, end);
          res2 = query(1, 1, size, start, size);
          res = min(res1, res2);
        } else {
          res = query(1, 1, size, start, end);
        }
        cout << res << '\n';
      }
    }
  }
  return 0;
}
