#ifndef LOCAL #include using namespace std; #define debug(...) (void(0)) #else #include "algo/debug.h" #endif #include using S = int64_t; S op(S a, S b) { return std::min(a, b); } constexpr S inf = std::numeric_limits::max(); S e() { return inf; } using F = int64_t; F id() { return 0; } F composition(F f, F g) { return f + g; } S mapping(F f, S x) { return f + x; } void solve() { int N; cin >> N; vector A(N); for (int i = 0; i < N; i++) cin >> A[i]; int Q; cin >> Q; atcoder::lazy_segtree seg(A); while (Q--) { int k, l, r, c; cin >> k >> l >> r >> c; l--; if (k == 1) { seg.apply(l, r, c); } else { cout << seg.prod(l, r) << '\n'; } } } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int tt = 1; // std::cin >> tt; while (tt--) { solve(); } }