#include <bits/stdc++.h>
using namespace std;
struct Noeud {
  long long mini, lazy;
  void update(long long add) {
    mini += add;
    lazy += add;
  }
};
const long long premier = 1 << 18, OO = 200000000000;
Noeud arbre[premier * 2];
void Add(long long left, long long right, long long reql, long long reqr,
         long long noeud, long long value) {
  if (left >= reql && right <= reqr) {
    arbre[noeud].update(value);
    return;
  }
  if (left > reqr || right < reql) return;
  if (arbre[noeud].lazy) {
    arbre[noeud * 2].update(arbre[noeud].lazy);
    arbre[noeud * 2 + 1].update(arbre[noeud].lazy);
    arbre[noeud].lazy = 0;
  }
  long long middle = (left + right) / 2;
  Add(left, middle, reql, reqr, noeud * 2, value);
  Add(middle + 1, right, reql, reqr, noeud * 2 + 1, value);
  arbre[noeud].mini = min(arbre[noeud * 2].mini, arbre[noeud * 2 + 1].mini);
}
long long query(long long left, long long right, long long reql, long long reqr,
                long long noeud) {
  if (left >= reql && right <= reqr) {
    return arbre[noeud].mini;
  }
  if (left > reqr || right < reql) return OO;
  if (arbre[noeud].lazy) {
    arbre[noeud * 2].update(arbre[noeud].lazy);
    arbre[noeud * 2 + 1].update(arbre[noeud].lazy);
    arbre[noeud].lazy = 0;
  }
  long long middle = (left + right) / 2;
  long long res = min(query(left, middle, reql, reqr, noeud * 2),
                      query(middle + 1, right, reql, reqr, noeud * 2 + 1));
  arbre[noeud].mini = min(arbre[noeud * 2].mini, arbre[noeud * 2 + 1].mini);
  return res;
}
signed main() {
  long long nb_valeurs;
  cin >> nb_valeurs;
  for (long long i = premier; i < 2 * premier; ++i) arbre[i].mini = OO;
  for (long long i = 0; i < nb_valeurs; ++i) cin >> arbre[premier + i].mini;
  for (long long i = premier - 1; i > 0; --i)
    arbre[i] = {min(arbre[i * 2].mini, arbre[i * 2 + 1].mini), 0};
  long long nb_req;
  cin >> nb_req;
  char tab[100];
  gets(tab);
  for (long long i = 0; i < nb_req; ++i) {
    gets(tab);
    stringstream in(tab);
    long long left, right, add;
    in >> left >> right;
    ++right;
    ++left;
    if (in >> add) {
      if (right >= left)
        Add(1, premier, left, right, 1, add);
      else {
        Add(1, premier, left, premier, 1, add);
        Add(1, premier, 1, right, 1, add);
      }
    } else {
      if (right >= left)
        cout << query(1, premier, left, right, 1) << endl;
      else
        cout << min(query(1, premier, left, premier, 1),
                    query(1, premier, 1, right, 1))
             << endl;
    }
  }
  return 0;
}
