#include <bits/stdc++.h>
using namespace std;
char ctmp[100];
pair<long long, long long> seg[200010 << 2];
long long v;
long long arr[200010];
void pull(int n) {
  int ls = n << 1, rs = ls | 1;
  seg[n].first = min(seg[ls].first, seg[rs].first);
}
void push(int n, int l, int r) {
  if (seg[n].second) {
    int val = seg[n].second, ls = n << 1;
    int rs = ls + 1;
    seg[n].first += val;
    seg[n].second = 0;
    if (l == r) return;
    seg[ls].second += val, seg[rs].second += val;
  }
}
void build(int index, int l, int r) {
  seg[index].second = 0;
  if (l == r) {
    seg[index].first = arr[l - 1];
    return;
  }
  int ls = index << 1, rs = ls | 1;
  int mid = (l + r) >> 1;
  build(ls, l, mid);
  build(rs, mid + 1, r);
  seg[index].first = min(seg[ls].first, seg[rs].first);
}
long long query(int l, int r, int nl, int nr, int index) {
  push(index, nl, nr);
  if (nl > r || nr < l) return LLONG_MAX;
  if (l <= nl && nr <= r) {
    return seg[index].first;
  }
  int ls = index << 1, rs = ls | 1;
  int mid = (nl + nr) >> 1;
  long long ans = min(query(l, r, nl, mid, ls), query(l, r, mid + 1, nr, rs));
  pull(index);
  return ans;
}
void modify(int l, int r, int nl, int nr, int index) {
  push(index, nl, nr);
  if (nl > r || nr < l) return;
  if (l <= nl && nr <= r) {
    seg[index].second += v;
    push(index, nl, nr);
  } else {
    int mid = (nl + nr) >> 1, ls = index << 1, rs = ls | 1;
    modify(l, r, nl, mid, ls);
    modify(l, r, mid + 1, nr, rs);
    pull(index);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, tmp;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  build(1, 1, n);
  cin >> m;
  cin.getline(ctmp, 100);
  while (m--) {
    int a, b, c;
    cin.getline(ctmp, 100);
    if (istringstream(ctmp) >> a >> b >> v) {
      a++, b++;
      if (a > b) {
        modify(1, b, 1, n, 1);
        modify(a, n, 1, n, 1);
      } else {
        modify(a, b, 1, n, 1);
      }
    } else {
      a++, b++;
      if (a > b) {
        long long x = query(a, n, 1, n, 1);
        long long y = query(1, b, 1, n, 1);
        long long ans = min(x, y);
        cout << ans << endl;
      } else {
        cout << query(a, b, 1, n, 1) << endl;
      }
    }
  }
}
