#include <bits/stdc++.h>
using namespace std;
const int N = 200100 * 4;
vector<long long> tree(N), lazy(N, 0), a(N);
void upd(int i, int l, int r) { tree[i] = min(tree[i * 2], tree[i * 2 + 1]); }
void fix(int i, int l, int r) {
  if (lazy[i] != 0) {
    tree[i] += lazy[i];
    if (l == r) {
      lazy[i] = 0;
      return;
    }
    lazy[i * 2] += lazy[i];
    lazy[i * 2 + 1] += lazy[i];
    lazy[i] = 0;
  }
}
void build(int i, int l, int r) {
  if (l == r) {
    tree[i] = a[l - 1];
    return;
  }
  build(i * 2, l, (l + r) / 2);
  build(i * 2 + 1, (l + r) / 2 + 1, r);
  upd(i, l, r);
}
long long get(int i, int l, int r, int left, int right) {
  fix(i, l, r);
  if (l >= left && r <= right) {
    return tree[i];
  }
  if (left > r || right < l) {
    return LONG_LONG_MAX;
  }
  return min(get(i * 2, l, (l + r) / 2, left, right),
             get(i * 2 + 1, (l + r) / 2 + 1, r, left, right));
}
void update(int i, int l, int r, int left, int right, int x) {
  fix(i, l, r);
  if (l >= left && r <= right) {
    lazy[i] += x;
    fix(i, l, r);
    return;
  }
  if (left > r || right < l) {
    return;
  }
  update(i * 2, l, (l + r) / 2, left, right, x);
  update(i * 2 + 1, (l + r) / 2 + 1, r, left, right, x);
  upd(i, l, r);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  build(1, 1, n);
  int q;
  cin >> q;
  string garbage;
  getline(cin, garbage);
  for (int i = 0; i < q; i++) {
    string s;
    getline(cin, s);
    int t = count(s.begin(), s.end(), ' ');
    if (t == 1) {
      int l, r, j = 0;
      string str = "";
      while (s[j] != ' ') {
        str += s[j++];
      }
      l = stoi(str);
      str = "";
      for (j; j < s.length(); j++) {
        str += s[j];
      }
      r = stoi(str);
      l++, r++;
      if (l <= r) {
        cout << get(1, 1, n, l, r) << "\n";
      } else {
        cout << min(get(1, 1, n, l, n), get(1, 1, n, 1, r)) << "\n";
      }
    } else {
      int l, r, x, j = 0;
      string str = "";
      while (s[j] != ' ') {
        str += s[j++];
      }
      l = stoi(str);
      str = "";
      j++;
      while (s[j] != ' ') {
        str += s[j++];
      }
      r = stoi(str);
      str = "";
      for (j; j < s.length(); j++) {
        str += s[j];
      }
      x = stoi(str);
      l++, r++;
      if (l <= r) {
        update(1, 1, n, l, r, x);
      } else {
        update(1, 1, n, l, n, x);
        update(1, 1, n, 1, r, x);
      }
    }
  }
}
