#include <bits/stdc++.h>
using namespace std;
ifstream fin("arbint.in");
ofstream fout("arbint.out");
const int NMax = 4e5 + 5;
const int MMax = 1e5 + 5;
const int INF = 1e9;
int v[MMax];
int Aib[NMax], Lazy[NMax];
void BuildTree(int node, int lo, int hi){
if(lo > hi) return;
if(lo == hi){
Aib[node] = v[lo];
return;
}
int mid = (lo + hi) >> 1;
BuildTree(node * 2, lo, mid);
BuildTree(node * 2 + 1, mid + 1, hi);
Aib[node] = min(Aib[node * 2], Aib[node * 2 + 1]);
}
void Update(int node, int lo, int hi, int m, int M, const int &value){
if(Lazy[node]){
Aib[node] += Lazy[node];
if(lo != hi){
Lazy[node * 2] += Lazy[node];
Lazy[node * 2 + 1] += Lazy[node];
}
Lazy[node] = 0;
}
if(lo > hi || lo > M || hi < m) return;
if(lo >= m && hi <= M){
Aib[node] += value;
if(lo != hi){
Lazy[node * 2] += value;
Lazy[node * 2 + 1] += value;
}
return;
}
int mid = (lo + hi) >> 1;
Update(node * 2, lo, mid, m, M, value);
Update(node * 2 + 1, mid + 1, hi, m, M, value);
Aib[node] = min(Aib[node * 2], Aib[node * 2 + 1]);
}
int Query(int node, int lo, int hi, int m, int M){
if(Lazy[node]){
Aib[node] += Lazy[node];
if(lo != hi){
Lazy[node * 2] += Lazy[node];
Lazy[node * 2 + 1] += Lazy[node];
}
Lazy[node] = 0;
}
if(lo > hi || lo > M || hi < m) return INF;
if(lo >= m && hi <= M){
return Aib[node];
}
int A, B;
int mid = (lo + hi) >> 1;
A = Query(node * 2, lo, mid, m, M);
B = Query(node * 2 + 1, mid + 1, hi, m, M);
return min(A, B);
}
int main(){
int n, type, a, b, value;
fin >> n;
for(int i = 1; i <= n; i++) fin >> v[i];
BuildTree(1, 1, n);
fin >> n;
for(int i = 1; i <= n; i++){
fin >> type;
if(!type){
fin >> a >> b >> value;
Update(1, 1, n, a, b, value);
} else {
fin >> a >> b;
fout << Query(1, 1, n, a, b) << "\n";
}
}
return 0;
}