#include //#include //#pragma GCC optimize("Ofast") using namespace std; #define reps(i,s,n) for(int i = s; i < n; i++) #define rep(i,n) reps(i,0,n) #define Rreps(i,n,e) for(int i = n - 1; i >= e; --i) #define Rrep(i,n) Rreps(i,n,0) #define ALL(a) a.begin(), a.end() #define fi first #define se second typedef long long ll; typedef vector vec; typedef vector mat; ll N,M,H,W,Q,K,A,B; string S; typedef pair P; const ll INF = (1LL<<60); template bool chmin(T &a, const T &b){ if(a > b) {a = b; return true;} else return false; } template bool chmax(T &a, const T &b){ if(a < b) {a = b; return true;} else return false; } const int sz = 317, num = 317; struct node{ vec a; ll plus, mini; int L, R; node(){} node(int id, vec &_a) : a(sz), plus(0), mini(INF), L(id * sz), R((id + 1) * sz){ rep(i, sz) a[i] = (i + id * sz < (int)_a.size() ? _a[i + id * sz] : INF); mini = *min_element(ALL(a)); } void eval(bool mini_update = true){ rep(i, sz) a[i] += plus; plus = 0; mini = *min_element(ALL(a)); } void update(int l, int r, ll c){ if(R <= l || r <= L) return; if(l <= L && R <= r){ plus += c; }else{ eval(false); reps(i, max(L, l), min(R, r)) a[i] += c; mini = *min_element(ALL(a)); } } ll query(int l, int r){ if(R <= l || r <= L) return INF; if(l <= L && R <= r){ return mini + plus; }else{ eval(); ll res(INF); reps(i, max(L, l), min(R, r)) chmin(res, a[i]); return res; } } }; int main() { cin>>N; vec a(N); vector group(num); rep(i, N) cin>>a[i]; rep(i, num) group[i] = node(i, a); cin>>Q; rep(_, Q){ int k, l, r, c; cin>>k>>l>>r>>c; --l; if(k == 1){ rep(i, num) group[i].update(l, r, c); }else{ ll res(INF); rep(i, num) chmin(res, group[i].query(l, r)); cout<