#include <bits/stdc++.h>
struct Node {
  int s;
  int t;
  long long min;
  long long off;
  Node() : s(0), t(0), min(0), off(0) {}
};
template <typename Tree>
void initTree(Tree& tree, int x) {
  int lenTree = tree.size();
  if (2 * x >= lenTree) {
    return;
  } else {
    int left = 2 * x;
    int right = 2 * x + 1;
    initTree(tree, 2 * x);
    initTree(tree, 2 * x + 1);
    tree[x].s = tree[left].s;
    tree[x].t = tree[right].t;
    tree[x].min = std::min(tree[left].min, tree[right].min);
  }
}
template <typename Tree>
void inc(Tree& tree, int x, int s, int t, long long d) {
  if (tree[x].s == s && tree[x].t == t) {
    tree[x].min += d;
    tree[x].off += d;
  } else {
    int left = 2 * x;
    int right = 2 * x + 1;
    int p = tree[left].t;
    if (t <= p) {
      inc(tree, left, s, t, d);
    } else if (p < s) {
      inc(tree, right, s, t, d);
    } else {
      inc(tree, left, s, p, d);
      inc(tree, right, p + 1, t, d);
    }
    tree[x].min = std::min(tree[left].min, tree[right].min) + tree[x].off;
  }
}
template <typename Tree>
long long rmq(const Tree& tree, int x, int s, int t) {
  if (tree[x].s == s && tree[x].t == t) {
    return tree[x].min;
  } else {
    int left = 2 * x;
    int right = 2 * x + 1;
    int p = tree[left].t;
    long long min;
    if (t <= p) {
      min = rmq(tree, left, s, t);
    } else if (p < s) {
      min = rmq(tree, right, s, t);
    } else {
      min = std::min(rmq(tree, left, s, p), rmq(tree, right, p + 1, t));
    }
    return min + tree[x].off;
  }
}
int main() {
  int n;
  std::cin >> n;
  std::vector<int> a(n, 0);
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i];
  }
  int r = 0;
  while (1) {
    if ((1 << (r + 1)) <= n) {
      ++r;
    } else {
      break;
    }
  }
  int shift = (n - (1 << r)) * 2;
  int lenTree = (1 << r) * 2 + shift;
  std::vector<Node> tree(lenTree, Node());
  for (int i = shift; i < n; ++i) {
    int idx = n + i - shift;
    tree[idx].min = a[i];
    tree[idx].s = tree[idx].t = i;
  }
  for (int i = 0; i < shift; ++i) {
    int idx = 2 * n + i - shift;
    tree[idx].min = a[i];
    tree[idx].s = tree[idx].t = i;
  }
  initTree(tree, 1);
  int m;
  std::cin >> m;
  for (int i = 0; i < m; ++i) {
    int a, b;
    std::cin >> a >> b;
    std::string x;
    std::getline(std::cin, x);
    if (x.empty()) {
      long long min;
      if (a > b) {
        min = std::min(rmq(tree, 1, a, n - 1), rmq(tree, 1, 0, b));
      } else {
        min = rmq(tree, 1, a, b);
      }
      std::cout << min << std::endl;
    } else {
      int d = strtol(x.c_str(), 0, 10);
      if (a > b) {
        inc(tree, 1, a, n - 1, d);
        inc(tree, 1, 0, b, d);
      } else {
        inc(tree, 1, a, b, d);
      }
    }
  }
}
