#include <bits/stdc++.h>
using namespace std;
template <class Elem, class Tag, class F, class PushF>
class STree {
  using pii = std::pair<int, int>;
  F f;
  PushF pushTag;
  int base;
  std::vector<Elem> v;
  std::vector<Tag> tag;
  std::vector<pii> range;
  void runPush(int now) {
    pushTag(v[now * 2], tag[now]);
    pushTag(tag[now * 2], tag[now]);
    pushTag(v[now * 2 + 1], tag[now]);
    pushTag(tag[now * 2 + 1], tag[now]);
    tag[now] = Tag();
  }

 public:
  template <class It>
  STree(int n, It it) : f(), pushTag() {
    for (base = 0; (1 << base) < n; base++)
      ;
    v.resize(1 << (base + 1));
    tag.resize(1 << (base + 1));
    range.resize(1 << (base + 1));
    std::copy_n(it, n, v.begin() + (1 << base));
    for (int i = (1 << base); i < (1 << (base + 1)); i++)
      range[i] = {i - (1 << base), i - (1 << base)};
    for (int i = (1 << base) - 1; i > 0; i--) {
      v[i] = f(v[i * 2], v[i * 2 + 1]);
      range[i] = {range[i * 2].first, range[i * 2 + 1].second};
    }
  }
  const Elem &query(int start, int end, int now = 1) {
    if (range[now].first == start && range[now].second == end) return v[now];
    runPush(now);
    int mid = (range[now].first + range[now].second) / 2;
    if (start > mid)
      return query(max(mid + 1, start), end, now * 2 + 1);
    else if (end < mid + 1)
      return query(start, min(mid, end), now * 2);
    else
      return f(query(start, min(mid, end), now * 2),
               query(max(mid + 1, start), end, now * 2 + 1));
  }
  void set(int start, int end, Tag diff, int now = 1) {
    if (range[now].first == start && range[now].second == end) {
      pushTag(v[now], diff);
      pushTag(tag[now], diff);
      return;
    }
    runPush(now);
    int mid = (range[now].first + range[now].second) / 2;
    if (start <= mid) set(start, min(mid, end), diff, now * 2);
    if (end >= mid + 1) set(max(mid + 1, start), end, diff, now * 2 + 1);
    v[now] = f(v[now * 2], v[now * 2 + 1]);
  }
};
struct minType {
  const int &operator()(const int &x, const int &y) const { return min(x, y); }
};
struct addType {
  void operator()(int &lhs, const int &rhs) const { lhs += rhs; }
};
int main() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  istream_iterator<int> it(cin);
  STree<int, int, minType, addType> stree(n, it);
  int m;
  cin >> m;
  while (m--) {
    int s, e;
    cin >> s >> e;
    if (cin.peek() != '\n') {
      int diff;
      cin >> diff;
      if (e < s) {
        stree.set(0, e, diff);
        stree.set(s, n - 1, diff);
      } else
        stree.set(s, e, diff);
    } else {
      if (e < s)
        cout << min(stree.query(0, e), stree.query(s, n - 1)) << '\n';
      else
        cout << stree.query(s, e) << '\n';
    }
  }
}
